Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Concatenate columns from different Sql queries

639383Nov 18 2008 — edited Aug 5 2010
Hi ,

I have two different queries on a same table with different conditions. I cant have these conditions in a single query as the result is not what is expected. But i have few common columns and I want the results of these queries next to the common columns. Below are the two different queries ..which I want the output to be concatenated in terms of columns :

Query 1 :
select * from
( select location,facility,floor,phase, seat_type,count(seat_type) abc from sa_master_table group by location,facility,floor,phase, seat_type order by location,facility,floor,phase, seat_type)
pivot
(sum(abc) for seat_type in ('Cabin','PL','Regular', 'Squeeze'))

Query 2:
select * from
( select location,facility,floor,phase, seat_type,count(seat_type) xyz from sa_master_table where employee = 'Vacant' group by location,facility,floor,phase, seat_type order by location,facility,floor,phase, seat_type)
pivot
(sum(xyz) for seat_type in ('Cabin','PL','Regular', 'Squeeze'))

Hoping to find some solution for this..

Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 2 2010
Added on Nov 18 2008
6 comments
1,090 views