Combine results of 2 queries into 1 result row
920375Feb 27 2012 — edited Feb 27 2012Ok so I have 2 queries from 2 different tables, and I am combining them into one query as follows:
select * from
(select col1 from tblA where col1 = 'val1') a,
(select col2 from tblB where col2 = 'val2') b
and so the results return as (I am expecting only 1 result from each query):
col1 ... col2
=== ===
aa ... 11
The problem is, that when either of the subqueries returns no results, the entire query returns no results. I want a result row even if one query returns no results, as such:
col1 ... col2
=== ===
aa ... NULL
OR
col1 ... col2
=== ===
NULL ... 11
I have looked into the different types of joins and unions, but have had trouble finding anything simple that returns only one row - any suggestions?
Edited by: 917372 on Feb 27, 2012 4:28 PM
Edited by: 917372 on Feb 27, 2012 4:28 PM
Edited by: 917372 on Feb 27, 2012 4:29 PM
Edited by: 917372 on Feb 27, 2012 4:31 PM