I have a set of values(keys), 1,2,3,4,5 and following table:
id key ------ 1 2 2 8 3 4
If I need to check which of the given keys are in
This is a bit clunky, but it does work:
select sq.val from mytable t right join (select 1 as val union select 2 union select 3 union select 4 union select 5 ) as sq on t.col = sq.val where t.id is null;
Obligatory SQL Fiddle.