我的目标是做的正是一个LEFT OUTER JOIN打算使用4维恩图做: SQL图表 :
我的查询没有返回任何价值可言,在事实上,它应该在Consultant_Memberships减去存储Consultant_Memberships_Lists中的一个内返回所有。
请参阅SQL小提琴一个更容易理解:
SELECT *
FROM consultant_memberships
LEFT OUTER JOIN consultant_memberships_list
ON consultant_memberships.`id` =
consultant_memberships_list.membership_id
WHERE consultant_memberships_list.consultant_id = $id
AND consultant_memberships_list.membership_id IS NULL
该查询使用“5”作为演示目的的ID,试图挑选出正确的行。