sql - From a list of numbers I want to get those ids that are not present in the table -


i have list of ids want check if in employee table. want display not in table.

select * employee; employeeid|firstname|lastname 1         | john    | doe 2         | jane    | doe 

when run sql statement below hoping ids not present in employee table.

select '1', '2, '3', '4' "x1"from  employee x1 not in (select employeeid employee); 

you need transform numbers subquery, select ones not exists in table:

with t ( select 1 x1 dual union select 2 x1 dual union select 3 x1 dual ) select x1 t x1 not in (select employeeid employee) 

if have big list of ids , perform more complex queries, might worth looking creating temporary table store them, use temporary table instead of subquery suggested.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -