Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Problem sorting results of a Union query passed to Oracle
Dave,
Instead using ORDER BY login_timestamp(order by col_name), you should use ORDER BY 1(col_num).
The reason is that SQL does not require the column names retrieved by select-stmt1 to be identical to the column names retrieved by select-stmt2.
SELECT * FROM logfile_h WHERE (ssn = '123456789') UNION SELECT * FROM logfile WHERE (ssn = '123456789') ORDER BY login_timestamp
When I run this query, Oracle returns "Invalid Column Name". The query
runs fine without the ORDER BY clause. It also runs fine if I use the
ORDER
BY with only part of the select as in "SELECT * FROM logfile_h WHERE
(ssn =
'123456789') ORDER BY login_timestamp".
Any input appreciated.
Dave B.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Received on Mon Jun 21 1999 - 11:18:54 CDT
![]() |
![]() |