Find next most recent date
Date: Fri, 4 Jan 2008 01:18:15 -0800 (PST)
I have a table with a date column. I want to find the next latest date in the data in that table.
I have got this far:
SELECT SNAPSHOT_DATE, ROWNUM
FROM (SELECT DISTINCT SNAPSHOT_DATE FROM MONTHLY_SNAPSHOTS ORDER BY SNAPSHOT_DATE DESC ) WHERE ROWNUM > 0 which returns all the dates in the table.
If I change the where clause to WHERE ROWNUM = 1 I just get the most recent date.
But if I change the where clause to WHERE ROWNUM = 2 I get an empty recordset.
I seem to be missing something. Received on Fri Jan 04 2008 - 03:18:15 CST