db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John English <john.fore...@gmail.com>
Subject SQL help needed
Date Sun, 27 Nov 2016 10:13:33 GMT
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,
-- 
John English

Mime
View raw message