Hello,
DB2 V8 LUW.
I have a simple table A with fields ID and SESSION_NUMBER (integer).
One ID can have multiple session numbers.
For a given ID, I can find the last two sessions with a simple SQL:
select * from table where ID='xyz' order by SESSION_NUMBER desc fetch
first two rows only
This may be rather simple, but I am stuck:
How do I return only the last two sessions for each ID that this table
has?
TIA, Michel
DB2 V8 LUW.
I have a simple table A with fields ID and SESSION_NUMBER (integer).
One ID can have multiple session numbers.
For a given ID, I can find the last two sessions with a simple SQL:
select * from table where ID='xyz' order by SESSION_NUMBER desc fetch
first two rows only
This may be rather simple, but I am stuck:
How do I return only the last two sessions for each ID that this table
has?
TIA, Michel
Comment