Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Problem sorting results of a Union query passed to Oracle

Re: Problem sorting results of a Union query passed to Oracle

From: <shiling_at_math.wayne.edu>
Date: Mon, 21 Jun 1999 16:18:54 GMT
Message-ID: <7klol1$e9s$1@nnrp1.deja.com>


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.



Subject: Problem sorting results of a Union query passed to Oracle From: "David" <davidbr93_at_hotmail.com>
Date: 1999/06/21
Newsgroups: comp.databases.oracle.misc
I'm having a problem sorting the result of a UNION query. I'm using Oracle'
s built in OLE controls within Visual Basic to pass the following statement
when creating a dynaset.

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US