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

SELECT a subset of records in correct order 1

Status
Not open for further replies.

ChrisRChamberlain

Programmer
Mar 23, 2000
3,392
GB
Hi all

It's Friday and am suffering from brain failure. [sad]

The following code selects records 180 to 200 from the query but in descending order.

All that's required is to select the records in ascending order within the SELECT... code block
Code:
[COLOR=blue]lnRows = 20
lnOffset = 200

SELECT TOP lnRows company;
[tab]FROM C:\tables\contacts;
[tab]WHERE company IN;
[tab](SELECT TOP lnOffset company FROM C:\tables\contacts ORDER BY company ASC);
[tab]ORDER BY company DESC;
[tab]INTO CURSOR temp[/color][COLOR=green] && Correct records in reverse order[/color]
Presumably another WHERE... etc?

TIA

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommander.com
PDFcommander.co.uk
 
Ah I see.

It's querying all the data, then just not fetching all to PHP, but only $rowsPerPage records from an $offset.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top