RevDB: fetching rows

Jan Schenkel janschenkel at yahoo.com
Sun Jan 26 01:53:00 EST 2003


--- Yennie at aol.com wrote:
> Hello all,
> 
> I feel like I must be missing something here... but
> so far I'm stumped.
> I want to fetch a subset of rows from a database
> cursor; however, it seems I 
> can only grab a column. If I have a database cursor
> with 1,000 selected 
> records, how can I get just the first 50 without
> many calls to RevDB?
> 
> Brian
> 

Hi Brian,

Unfortunately, ANSI-SQL doesn't have a native solution
for that: you get all the records that fall within the
conditions of the WHERE-clause.

However, MySQL provides an extension to the standard
syntax - 'LIMIT' - which will do what you want. Eg:
  SELECT cust_id, cust_name FROM customer WHERE
     cust_id >= theCurrentId LIMIT 100
would get you the first 100 customers with an ID
higher than or equal to the one in theCurrentID.

Other databases _may_ support the same syntax, or
provide their own similar extension. But as they say:
your mileage may vary...

Hope this helped,

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



More information about the use-livecode mailing list