Search code examples
mysqlsqlcomparisonsql-query-store

Comparison between two tables inSQL


I want to know which "type" doesn't exist in snapshot table, but always got error on this:-

Select  * FROM 
     (Select type from snapshot) AS A where date = CURDATE())
    LEFT JOIN
     (Select type from register) AS B
ON A.type=B.type
WHERE B.type IS NULL

Can someone please help me?


Solution

  • Here's an example of a valid query:

    SELECT a.type 
      FROM snapshot a
      LEFT 
      JOIN register b
        ON b.type = a.type
     WHERE a.date = CURDATE()
       AND b.type IS NULL