0

我正在尝试从 id 不等于从链接表返回的 id 的数据库中取回行。这可以使用连接来完成吗?

select *
    from module_items_profile people
        where people.item_id not in (
            select link.people_id
                    from link_page_people link 
                        where link.page_id = $page_id
                        )
4

1 回答 1

0

是的,但是将 aLEFT JOINIS NULL谓词一起使用:

select *
from module_items_profile AS people
LEFT JOIN
(
  SELECT * 
  FROM link_page_people 
  where page_id = $page_id
) AS link ON people.item_id = link.people_id
WHERE link.people_id IS NULL;
于 2013-07-09T14:42:34.900 回答