Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NTH select in VFP6

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello all, I have a database, that I want to set up nth selects based on a number of available records to fill a certain qty, and I need to know the best way to do this.

for example if my database is say 1000 records, and I want to pull a total of 100 records, I will NTH across the file to pull 10 percent, or every 10th record. Of course, it wont always be those nice whole numbers.

Please help,

Thanks in advance.
-Mike
 
Hi,

You can use following query to select desired no. or percent of record.

SELECT TOP 10 PERCENT * FROM myTable ORDER BY myColumn

Ofcourse, if you omit "PERCENT" clause then there will be no need to give fraction numbers (e.g. 10.5). In that case it always make the integer part of fraction and then give you the result.
 
Hi Mike,

You can do something like:

SELECT * from tablex WHERE MOD(RECNO(), qty) = 0 INTO CURSOR cursorx

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top