- 有一张桌子
Products有p_no和p_desc。 - 有一张表
order_details(p_no同上)。
我需要p_descwhere products.p_nois 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属性的,所以我假设这是错误的。