选择tbl1中未列出的tbl1

时间:2013-01-13 10:57:00

标签: mysql sql

我需要进行MySQL查询以选择TBL1中未列出的TBL2中的记录,但不使用我的查询。

SELECT deleted_guids.guid_type
     , HEX(data_table.guid_id) as guid_id
     , HEX(data_table.guid_type) as guid_type
FROM data_table 
LEFT JOIN deleted_guids 
     ON     data_table.guid_id = deleted_guids.guid_id 
        AND data_table.guid_type = deleted_guids.guid_type 
WHERE deleted_guids.guid_type = NULL;

1 个答案:

答案 0 :(得分:4)

您最后需要将= NULL更改为IS NULL;这是正确的语法。请参阅working with NULL values