Reputation: 59
SQL> SELECT * FROM AUDIT;
PROCESS TIME INDICATOR
---------- --------- ---------
1.1 01-MAR-14 A
1.2 01-APR-14 A
1.3 01-APR-14 A
1.2 01-MAY-14 B
1.2 01-JUN-14 A
1.4 01-APR-14 B
My data is above format and if I will modify anything on this data and then whenever i will query from table, I should get latest modified date data.
Upvotes: 0
Views: 52
Reputation: 49082
Oracle 12c introduced the Top-n query. So, you could do it in a single SQL without using a sub-query for ROWNUM.
SELECT * FROM AUDIT
ORDER BY TIME DESC
FETCH FIRST 1 ROW ONLY;
Upvotes: 0
Reputation: 172448
Try this:
SELECT *
FROM (SELECT * FROM AUDIT ORDER BY TimeColumn desc )
WHERE ROWNUM = 1;
Upvotes: 1