Hi John,
The outer join is the typical SQL approach to computing the difference
between two relations:
select * from x left join y
on x.a = y.a and x.b = y.b
where y.a is null;
Hope this helps,
-Rick
On 11/27/16, 2:13 AM, John English wrote:
I'm trying to find all rows in a table where a pair of values is not
in anther table: that is, I want to do something like this:
SELECT * FROM x WHERE (a,b) NOT IN (SELECT DISTINCT a,b FROM y);
which of course doesn't work.
At the moment I've bodged around it by doing this:
SELECT * FROM x WHERE a||'-'||b NOT IN (SELECT DISTINCT a||'-'||b
FROM y);
but this strikes me as really ugly. Can anyone a more elegant way to
get what I want?
TIA,