Am 27. November 2016 11:13:33 MEZ, schrieb John English 
<john.fore...@gmail.com>:
>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,

Hi,

Can this problem be solved by an correlating sub select?!

Maybe something like this:
Select * from x where not exists ( select 1 from y where x.a = y.a and x.b = 
y.b )

Or like your first SQL but convert to string and concatenate that would work 
but probably very slow as no index could be used.

With kind regards
Thomas

Reply via email to