Concatenate columns from different Sql queries
639383Nov 18 2008 — edited Aug 5 2010Hi ,
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!