【发布时间】:2011-02-14 17:42:36
【问题描述】:
我有两个 sql 表,我想将它们相互对照以找到不匹配的表。
我有一些有用的东西,但由于某种原因错过了两条记录?
表 flag_content 包含: - 用户身份 - content_id
table topfive_order 包含 - 尼德 - uid
我希望找到所有在 flag_content.content_id 中不存在 topfive_order.nid 的记录
我目前的查询是:
select * from flag_content left join topfive_order topfive_order ON flag_content.content_id = topfive_order.nid WHERE topfive_order.nid is null
非常欢迎任何提示或建议。我不太清楚我用左连接做了什么。所以我认为这几条漏网的记录与此有关。
【问题讨论】:
-
查询似乎正确。你缺少的两条记录,它们在topfive_order 表中吗?