- 有一张桌子
Products
有p_no
和p_desc
。 - 有一张表
order_details
(p_no
同上)。
我需要p_desc
where products.p_no
is not in order_details
。
注意:我做了很多搜索,这就是我想出的结果。
-- Why would this work?
select p_desc from products
except
select p_no from order_details
-- Then,
select p_desc from products
where products.p_no not in order_details.p_no
-- and finally,
select p_desc from products
where (p_no not in (select p_no from order_details))
这些都对吗?有人告诉我使用except
,但我看不到第一个语句是如何比较p_no
属性的,所以我假设这是错误的。