Finding Non Matches in SQL Statement

TheLettuceMaster

I have a query that looks like this:

SELECT u_s_date, u_s_customer, u_s_product_name, u_f_quantity FROM updated
JOIN accounts ON `name` = u_s_customer
WHERE deleted = 0; 

That compares of list in a table called updated of 400 product orders. I am joining to a table of accounts because not all customer names from the updated table are in the accounts table. So that takes the list from 400 to about 300 names.

What I need is to now make another list of the 100 rows that are not being included.

I tried things like JOIN accounts ON `name` <> u_s_customer and that obviously didn't work. I am not good with subqueries and conditions and I am afraid that is the only way to do this.

Can someone give me some help on this?

M.Ali

EXISTS OPERATOR

SELECT *
FROM updated u
WHERE NOT EXISTS (SELECT 1
                  FROM accounts 
                  WHERE `name` = u_s_customer)

LEFT JOIN

SELECT *
FROM updated LEFT JOIN accounts 
ON `name` = u_s_customer
WHERE name IS NULL

NOT IN

SELECT *
FROM updated 
WHERE name NOT IN (SELECT u_s_customer
                   FROM accounts )

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Recursive SQL query for finding matches

From Dev

Finding a Specific Character in SQL Statement

From Dev

Finding a ruby hash value in an SQL statement search

From Dev

Matcher not finding matches

From Dev

Matcher not finding matches

From Dev

Linq to entities: finding matches

From Dev

Finding matches in c++

From Dev

Need help finding many float value errors in a large SQL statement

From Dev

Finding the "&" character in SQL SERVER using a like statement and Wildcards

From Dev

Continuous and non continuous date spans in Oracle SQL: Finding the earliest date

From Dev

python regex for finding all matches

From Dev

Regular expression not finding both matches

From Dev

Finding a subdirectory that matches a file name

From Dev

JavaScript: Finding successive matches with .exec()

From Dev

Finding absolute value with if statement

From Dev

Finding Non Matching ID

From Dev

Finding Non Matching ID

From Dev

Finding non overlapping squares?

From Dev

How to ignore non alphanumeric characters for SQL LIKE statement?

From Dev

Use parameters for non-value items in sql statement

From Dev

How to write an IF statement in SQL to hide the non duplicated row

From Dev

removing non-matching rows based on order in SQL within a WITH statement

From Dev

T-Sql MERGE statement update when criteria matches newly inserted record

From Dev

T-Sql MERGE statement update when criteria matches newly inserted record

From Dev

Finding out the type of value passed is select statement or csv without using SQL predefined keyword

From Dev

Why is my simple SQL statement taking so long to execute and how do i go about finding the issue?

From Dev

Finding indices of matches of one array in another array

From Dev

Finding matches between identical MYSQL tables

From Dev

Finding matches in a matrix of cells against a second worksheet

Related Related

  1. 1

    Recursive SQL query for finding matches

  2. 2

    Finding a Specific Character in SQL Statement

  3. 3

    Finding a ruby hash value in an SQL statement search

  4. 4

    Matcher not finding matches

  5. 5

    Matcher not finding matches

  6. 6

    Linq to entities: finding matches

  7. 7

    Finding matches in c++

  8. 8

    Need help finding many float value errors in a large SQL statement

  9. 9

    Finding the "&" character in SQL SERVER using a like statement and Wildcards

  10. 10

    Continuous and non continuous date spans in Oracle SQL: Finding the earliest date

  11. 11

    python regex for finding all matches

  12. 12

    Regular expression not finding both matches

  13. 13

    Finding a subdirectory that matches a file name

  14. 14

    JavaScript: Finding successive matches with .exec()

  15. 15

    Finding absolute value with if statement

  16. 16

    Finding Non Matching ID

  17. 17

    Finding Non Matching ID

  18. 18

    Finding non overlapping squares?

  19. 19

    How to ignore non alphanumeric characters for SQL LIKE statement?

  20. 20

    Use parameters for non-value items in sql statement

  21. 21

    How to write an IF statement in SQL to hide the non duplicated row

  22. 22

    removing non-matching rows based on order in SQL within a WITH statement

  23. 23

    T-Sql MERGE statement update when criteria matches newly inserted record

  24. 24

    T-Sql MERGE statement update when criteria matches newly inserted record

  25. 25

    Finding out the type of value passed is select statement or csv without using SQL predefined keyword

  26. 26

    Why is my simple SQL statement taking so long to execute and how do i go about finding the issue?

  27. 27

    Finding indices of matches of one array in another array

  28. 28

    Finding matches between identical MYSQL tables

  29. 29

    Finding matches in a matrix of cells against a second worksheet

HotTag

Archive