Re: SQL help

  • From: "Steve T. Baldwin" <stbaldwin@xxxxxxxxxxxxxxxx>
  • To: Oracle-L <oracle-l@xxxxxxxxxxxxx>, "nupendra@xxxxxxxxxxx" <nupendra@xxxxxxxxxxx>
  • Date: Tue, 24 May 2016 04:39:52 +0000

Maybe a cartesian join to a 2-row dual.  Something like (untested):


with t2 as (select rownum rnum from dual connect by level <= 2)

select case rnum when 1 then a else b end

from test, t2;


hth,


Steve

________________________________
From: oracle-l-bounce@xxxxxxxxxxxxx <oracle-l-bounce@xxxxxxxxxxxxx> on behalf 
of Upendra nerilla <nupendra@xxxxxxxxxxx>
Sent: Tuesday, 24 May 2016 7:58:50 AM
To: Oracle-L
Subject: SQL help

Hey guys,
Could someone help with a SQL:

I have a test table with 2 rows:

create table test (a varchar2(50), b varchar2(50));
insert into test values ('one', 'first row');
insert into test values ('two', 'second row');
commit;

I need a query that shows the output as the following (without using union). 
Order of the values is not important.

OUTPUT
=======
one
first row
two
second row

I thought unpivot might work, poked around a bit..  my brain is too tired to 
think..

Thanks in advance
-Upendra
------------------------------------------------------- This email is intended 
solely for the use of the addressee and may contain information that is 
confidential, proprietary, or both. If you receive this email in error please 
immediately notify the sender and delete the email. 
-------------------------------------------------------

  • References:

Other related posts: