Am 28.03.20 um 10:11 schrieb Riccardo (Jack) Lucchetti:
On Sat, 28 Mar 2020, Artur Tarassow wrote:
> Hi Allin,
>
> this issue seems fixed. The query yields the correct results now.
> Thank you!
>
> But let me pose another issue: Suppose one wants to fetch
> cross-sectional data from the DB but one has no idea of how many rows
> the table has. In the past it was possible to initialize a very large
> gretl dataset of R rows and to fetch some table with r<=R rows. Gretl
> just filled the first r rows with data fetched, and the remaining R-r
> rows where all NA and could be dropped in another step.
I've used the following workaround:
<hansl>
clear
open dsn=MyDSN user=jack password=pwd --odbc
nulldata 1
data tmp query="select count(*) from tablename" --odbc
scalar n = tmp[1]
nulldata n --preserve
q1 = sprintf("select whatever from somedata limit %d", $nobs)
data foobar query=q1 --odbc
</hansl>
Simple but very nice idea, Jack! Thanks.
However, in case one is working with multiple large tables which must be
joined, this is not very efficient since the DB needs to process
everything twice.
Artur