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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NTH select

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Help!

I was using some code to do a nth select, and I think it's wrong.

this is what I am using:
select * from myfile where maildate=' ' .and. mod(recno(),2) = 0 into cursor mike

it gives me a real nice sampling accross the file, but now I am to the point where there is only 36000 records left, and I want to nth off 16000, and I only get 12716. I think this command was giving me records where the recno() ends in 2.

I need to know how to NTH select. Example: If I have 10 records in my database, and I want exactly 2, I would NTH select 20% of that file, and it would only pull every 5th record.


Any help is always very much appreciated,

-Mike
 
With all probability, maildate for some records
is not ""...
 
Dear Friend,

You are using this...
select * from myfile where maildate=' ' .and. mod(recno(),2) = 0 into cursor mike

Instead use this
select * from myfile where maildate<>{} .and. mod(recno(),2) = 0 into cursor mike

1. if maildate is a date then you can use ' ' have to use {}
2. you get 0 records because you are joining both the conditions i.e. you want the result to display records where maildate is empty and every nth record of empty maildate.

3. if you want every nth record then remove the maildate otherwise use &quot;OR&quot; instead of &quot;AND&quot;


Aslam Abbas
Salmiya, Kuwait.
aslamabbas@hotmail.com
 
you may want to confirm the set deleted environment status

if SET DELETED ON you will not return any deleted records and hence get unexpected results with the select criteria. see if these return the same records

SET DELETED OFF
select * from myfile where !EMTPY(maildate) .and. mod(recno(),2) = 0 into cursor mike
? _tally

SET DELETED ON
select * from myfile where !EMTPY(maildate) .and. mod(recno(),2) = 0 into cursor mike
? _tally

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top