表orders
O_Id OrderDate OrderPrice Customer
1 2001-01-01 253 a
2 2001-01-02 252 b
3 2001-01-03 253 c
3 2001-01-03 253 c
4 2001-02-02 25 NULL
想查找和顾客c购买价格一样的顾客,
select customer from orders where orderprice in(select orderprice from orders where customer='c')
就能执行,但将in变成=就不行了,为啥呢
------解决思路----------------------
单纯你这个例子:
select customer from orders where orderprice in(select distinct orderprice from orders where customer='c')
应该可以,但是in和=有不同的使用范围