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!

Can I show the value of the NEXT record in a query? 1

Status
Not open for further replies.

Hanss

Technical User
Feb 15, 2001
85
CH
I have a table "test" with the following fields and data:

id: date:
1 16.01.2006
2 17.01.2006
3 19.01.2006
4 21.01.2006


Is it possible to have a query with an additional field "date2" which displays the "date" value from the next record?

Something like this:

SELECT test.id, test.date, ([nextrecord].[date]) AS date2
FROM test;

Would appreciate any help.

kind regards,
Hanss
Zurich
 
You could try joining the table with itself with something like:
[TT]
... WHERE a.id = b.id+1
[/TT]
but you'll have to do something at the end of the table to avoid referring to the record that's after the last record.

Geoff Franklin
 
It worked!

Thank you for showing me the right direction.

Hanss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top