MAX() behaviour with ROWNUM
161459Mar 18 2003 — edited Mar 18 2003We use a period/week calendar which has weeks like 03P01W1, 03P01W2 etc
I have a query to find the week +2 of the week specified.
It looks like this:
SELECT max(Week_Id)
FROM Week
WHERE Week_Id > '03P05W1'
AND ROWNUM <= 2
The where clause should limit the result set to:
03P05W2 and 03P05W3
The MAX function then picks out 03P05W3 as the highest (and so furthest in the future).
This runs on 2 'identicle' databases, a test and production.
However, on one of the databases it returns 04P13W5, which is the last entry in the table.
Any ideas why ?!?!?!