Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SELECT specified number of records
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00850530
Message ID:
00850532
Views:
16
>I have a SELECT SQL into a CURSOR. I only want a specified number of records as a maximum in the cursor. How is the easiest way to accomplish this?

You can use the TOP clause
SELECT TOP nnn * FROM mytable ;
  WHERE ... ;
  ORDER BY ... ;
  INTO CURSOR mycursor READWRITE
IF _TALLY > nnn
  GOTO (nnn+1)
  DELETE REST
ENDIF
Keep in mind that there could be more than nnn records in cursor if there is tie between the record nnn and following records.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform