Don’t do:
SELECT first_name, last_name
FROM employees
WHERE rownum = 1
ORDER BY creation_date DESC
You probably want to do this instead:
SELECT * from (
SELECT first_name, last_name
FROM employees
ORDER BY creation_date DESC
) where rownum = 1
The first query takes the first row returned by Oracle and orders it by creation_date.
The second query gets the first row of the sub-query that contains the sorted records.
More on Stack Overflow
Written by Dorin Moise (Published articles: 277)
- Likes (0)
-
Share
- Comments (0)