Get values from a table which are not present only in the 'IN' clause

Analysts

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?

Gordon Linoff

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Get the values which is not present in table?

From Dev

How to get values which are not present in other table

From Dev

How do I get all values present in one table, but only some from another table

From Dev

how to get value from one table which is not present in another that?

From Dev

How to select values which are not present in another table?

From Dev

Serial chart which starts from 0 if only positive values are present, but accepts negatives as well

From Dev

How to find records from table A, which are not present in table B?

From Dev

Get Values from dictionary present in List

From Dev

Fetch rows in MySQL which are not present in both columns from another table

From Dev

Fetch rows in MySQL which are not present in both columns from another table

From Dev

Select query to get values from a table column only if the values are not in another table

From Dev

Select query to get values from a table column only if the values are not in another table

From Dev

Get condition of WHERE clause from table

From Dev

How to pass specific table values to ajax which we get from a database table?

From Dev

Group by in data.table in R which only keep non NA values from columns

From Dev

Union which excludes values from the first table

From Dev

Show elements of where clause that are not present in table

From Dev

How to get values from resultset which satisfies some condition and display that in table

From Dev

How to get all the rows from MySQL table which have same values for multiple columns?

From Dev

how to get the average and std deviation of daily totals from table in which date values are stored by hour mysql?

From Dev

Get distinct values from table

From Dev

How to get values from table

From Dev

Get the values from a table of checkboxes

From Dev

Get minimum values only for duplicates in table

From Dev

Retrieve values from configuration table in query where clause

From Dev

Retrieve values from configuration table in query where clause

From Dev

Need to fetch records from one table which is not present in another one table

From Dev

Need to fetch records from one table which is not present in another one table

From Dev

How to avoid all records which has a duplicate present and get only unique records?

Related Related

  1. 1

    Get the values which is not present in table?

  2. 2

    How to get values which are not present in other table

  3. 3

    How do I get all values present in one table, but only some from another table

  4. 4

    how to get value from one table which is not present in another that?

  5. 5

    How to select values which are not present in another table?

  6. 6

    Serial chart which starts from 0 if only positive values are present, but accepts negatives as well

  7. 7

    How to find records from table A, which are not present in table B?

  8. 8

    Get Values from dictionary present in List

  9. 9

    Fetch rows in MySQL which are not present in both columns from another table

  10. 10

    Fetch rows in MySQL which are not present in both columns from another table

  11. 11

    Select query to get values from a table column only if the values are not in another table

  12. 12

    Select query to get values from a table column only if the values are not in another table

  13. 13

    Get condition of WHERE clause from table

  14. 14

    How to pass specific table values to ajax which we get from a database table?

  15. 15

    Group by in data.table in R which only keep non NA values from columns

  16. 16

    Union which excludes values from the first table

  17. 17

    Show elements of where clause that are not present in table

  18. 18

    How to get values from resultset which satisfies some condition and display that in table

  19. 19

    How to get all the rows from MySQL table which have same values for multiple columns?

  20. 20

    how to get the average and std deviation of daily totals from table in which date values are stored by hour mysql?

  21. 21

    Get distinct values from table

  22. 22

    How to get values from table

  23. 23

    Get the values from a table of checkboxes

  24. 24

    Get minimum values only for duplicates in table

  25. 25

    Retrieve values from configuration table in query where clause

  26. 26

    Retrieve values from configuration table in query where clause

  27. 27

    Need to fetch records from one table which is not present in another one table

  28. 28

    Need to fetch records from one table which is not present in another one table

  29. 29

    How to avoid all records which has a duplicate present and get only unique records?

HotTag

Archive