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

find the date of xth from last order 1

Status
Not open for further replies.

stevebanks

Programmer
Mar 30, 2004
93
hi!

I am trying to work out a way of finding out the details from the 1000th from last order from our order table.

Can someone help me with a query.., it's got me a little stumped!

Ta!
 
The order number is incremental if that's any help?
 
Something like this ?
SELECT * FROM yourOrderTable
WHERE OrderNumber=(SELECT Max(OrderNumber) FROM yourOrderTable)-1000

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I'm getting an error "invalid use of subquery" when i try this:

Code:
SELECT cms.odr_date
FROM cms
WHERE (((cms.order)=(SELECT Max(order) FROM cms)-1000));
The tables are coming from an ODBC link to a Foxpro DB which our mail order management system is built on... Would this cause the problem?
 
And this ?
SELECT odr_date
FROM cms
WHERE [order]=DMax('[order]','cms')-1000

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top