I'm trying to write query that will select rows from 1 table and using that select rows from another table. The catch is that the other table may not have a matching row.
An example
Select client, site, product, family
from tab_a
where product = 'a'
on the other table (tab-b) are the values for product status and cancel date.
Select prod_status, cancel_date
from tab_b
where tab_b.client = tab_a.client
and tab_b.site = tab.a.site
and tab_b.product = tab_a.product
I tried exists and product in, but they only return the row if it is a match. If the tab_b doesn't have a match, than no row is returned.
I'm trying to do this in 1 SQL statement to use in Excel.
It is for DB2 v7
An example
Select client, site, product, family
from tab_a
where product = 'a'
on the other table (tab-b) are the values for product status and cancel date.
Select prod_status, cancel_date
from tab_b
where tab_b.client = tab_a.client
and tab_b.site = tab.a.site
and tab_b.product = tab_a.product
I tried exists and product in, but they only return the row if it is a match. If the tab_b doesn't have a match, than no row is returned.
I'm trying to do this in 1 SQL statement to use in Excel.
It is for DB2 v7