【发布时间】:2021-12-17 00:11:41
【问题描述】:
我必须从客户表中获取记录,其中客户gift_type 仅为“现金”,但这些客户不应该签署“优惠券”和“折扣”。以下是我的查询,它没有提供确切的记录。超过 1 个 gift_type 也包括在内。我也试过用子查询,还是不行。
select cust_id from customer where gift_type='cash' and gift_type != 'coupon' and gift_type != 'discount';
&
select cust_id
from customer c1, customer c2
where c1.gift_type='cash' and c2.gift_type != 'coupon' and c2.gift_type != 'discount';
提前感谢您的帮助。
【问题讨论】:
-
你用的是oracle还是mysql?
-
我正在使用 oracle
标签: mysql sql oracle where-clause