sql - missing rows, how to select values -
how accomplish this: have bunch of numbers (for example: 2342423; 34443123; 3523423) , of them in database table primary key value. want select numbers, not in table. best way this?
if few numbers can do
select tmp.num ( select 2342423 num union select 34443123 union select 3523423 ) tmp left join your_table t on t.id = tmp.num t.id null
if more few numbers should insert these table , left join
against table this
select twntc.num table_with_numbers_to_check twntc left join your_table t on t.id = twntc.num t.id null
Comments
Post a Comment