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
Post a Comment