时间:2021-07-01 10:21:17 帮助过:27人阅读
3个结果合并以id排序,然后取出数据.
这样的语句应该怎么写呀?
1比如,我要价格在20-30 50-60 70-80 价格区间的商品,关系为or
2同时标题要包含裙子,上衣,外套关系为or,
3还要排除标题包含童装,书籍,关系为and,
3个结果合并以id排序,然后取出数据.
这样的语句应该怎么写呀?
select * from tb_name where
(
(price between 20 and 30) or
(price between 50 and 60) or
(price between 70 and 80)
) and
(
(title='裙子' or title='上衣' or title='外套') and
(title<>'童装' or title<>'书籍')
)
order by id asc;
(价格区间1 or 价格区间2 or 价格区间3) and (标题1 or 标题2 or 标题3) and (标题 not in(....)) order by id