oracle11g - How to put 2 rows returned from a query into into 2 columns of a single row in Oracle sql -
i run query returns 2 rows
select table-a condition=something;
row1 value1
row2 value2
now, want put in new table in 2 columns of single row
select column1, column2 table-b condition=something;
row1 column1 column2
value1 value2
can please me this?
it unclear how want pick row goes column - here couple of options:
select min( ) minimum_value, max( ) maximum_value table_a 1=1;
or
select max( ) keep ( dense_rank first order rownum ) first_value, max( ) keep ( dense_rank last order rownum ) last_value table_a 1=1;
or
select * ( select a, rownum rn table_a 1=1 ) pivot ( max(a) rn in ( 1 first_value, 2 second_value ) );
Comments
Post a Comment