Trying to figure how how to replace the following, with equivalent left outer join:
select distinct(a.some_value)
from table_a a, table_b b
where a.id = b.a_id
and b.some_id = 123
and b.create_date < '2014-01-01'
and b.create_date >= '2013-12-01'
MINUS
select distinct(a.some_value)
from table_a a, table_b b
where a.id = b.a_id
and b.some_id = 123
and b.create_date < '2013-12-01'
Can not do "NOT IN", as the second query has too much data.
SELECT * FROM
(
select distinct(a.some_value)
from table_a a, table_b b
where a.id = b.a_id
and b.some_id = 123
and b.create_date < '2014-01-01'
and b.create_date >= '2013-12-01'
) x
LEFT JOIN
(
select distinct(a.some_value)
from table_a a, table_b b
where a.id = b.a_id
and b.some_id = 123
and b.create_date < '2013-12-01'
) y
ON
x.some_value = y.some_value
WHERE
y.some_value IS NULL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With