这一句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.7k
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'
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进