我有两张桌子:
t1
------------
id
user
t2
------------
user_id
item
如果在t2
中找不到匹配的记录,我需要从t1中选择SELECT *
FROM t1
LEFT JOIN t2 ON (t1.id = t2.user_id)
WHERE ???
有点卡住......
答案 0 :(得分:5)
SELECT t1.*
FROM t1
LEFT JOIN t2 ON t1.id = t2.user_id
WHERE t2.user_id IS NULL
答案 1 :(得分:0)