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

Home -> Community -> Usenet -> c.d.o.server -> Re: Is this possible in oracle

Re: Is this possible in oracle

From: <fitzjarrell_at_cox.net>
Date: 27 Mar 2005 06:21:45 -0800
Message-ID: <1111933305.616937.229800@z14g2000cwz.googlegroups.com>

nekkalapudi.siva_at_gmail.com wrote:
> I have the following query
>
> SELECT t1.*
> FROM t1
> UNION ALL
> SELECT t2.*
> FROM t2
>
> Now the question is can we display T1 data first and then T2 data
next
> with out using UNION ALL

Yes:

SELECT t1.*, 'T1' as t1
FROM t1
UNION ALL
SELECT t2.*, 'T2' as t1
FROM t2;

Thsi shuold place data from table t1 before data from t2, along with a 'tag' to identify the data source. You can also suppress the tag by:

column t1 noprint

which should continue to output the data in table order, data from t1 before data from t2. The question I ask now is 'Why do you 'need' such functionality?' Or is this an exercise proving the knowledge level of the newsgroup?

David Fitzjarrell Received on Sun Mar 27 2005 - 08:21:45 CST

Original text of this message

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