I want to get values which are not present in the table ,by considering the values only in the IN clause .
For example ,
select orderNumber from order where orderNumber in (List of orderNumbers)
This will give the orderNumbers which are present in the table by considering the values present in the IN clause , likewise I want the orderNumbers which are not present in the table by considering the values present in the IN clause .
Is there any query logic present to handle this situation?
You need a join to do this with a left outer join
and a where
clause:
select on.*
from (select 1 as OrderNumber from dual union all
select 2 from dual
. . .
select n from dual
) ordn left outer join
orders o
on o.ordernumber = ordn.ordernumber
where o.ordernumber is NULL;
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments