[Pulled from dbforums]
If you want to use ROWNUM or SORT across the results of a UNION:SELECT *
FROM (
SELECT employee_id, last_name, first_name
FROM EMPLOYEES
UNION
SELECT department_id, 'DEPT', department_name
FROM DEPARTMENTS
)
WHERE ROWNUM < 100
ORDER BY last_name;
* I realize this is a brutaly contrived example, but hey, whaddaya expect?
** I have no idea how this performs.
Monday, May 02, 2005
ORACLE: Using ROWNUM or SORT with UNION
Posted by BigEasy at 5/02/2005 09:45:00 AM
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment