这一句sql做不到吗?

type 有1,2,3,三种。我只需要显示1和2的
同时我要在type=2中筛选出Price1< '10' and price2> '200' 的数据。
下面我这样写导致type=1的不显示了。
请问该如何解决,谢谢。

where (Price1< '10' and price2> '200' and Type= '2')  and Type<> '3' 
阅读 1.8k
3 个回答
✓ 已被采纳
select * from test
where (type = 2 and p1 < 10 and p2 > 200) or type=1

and Type<> '3' 改成 or Type = '1' 不行吗?

明显要用union

where Type= '1'
union 
where Price1< '10' and price2> '200' and Type= '2'