为了账号安全,请及时绑定邮箱和手机立即绑定

你好,求解,关于在mysql中用like实现多条件模糊查询?内容太多,请看下面

你好,求解,关于在mysql中用like实现多条件模糊查询?内容太多,请看下面

眼眸繁星 2021-06-02 11:07:31
SELECT BigCategory,SmallCategory,Model_No,1 'yuefen',SUM(case when BizType='P' then MONTH1Num end ) as P,SUM(case when BizType='S' then MONTH1Num end ) as S,SUM(case when BizType='I' then MONTH1Num end ) as I,SUM(case when BizType='P' then MONTH1Num end )- SUM(case when BizType='S' then MONTH1Num end )-SUM(case when BizType='I' then MONTH1Num end ) PanDianFROM t_testWHERE Model_No like 'iphone4s%'OR WHERE Model_No like 'v480%'SELECT BigCategory,SmallCategory,Model_No,1 'yuefen',SUM(case when BizType='P' then MONTH1Num end ) as P,SUM(case when BizType='S' then MONTH1Num end ) as S,SUM(case when BizType='I' then MONTH1Num end ) as I,SUM(case when BizType='P' then MONTH1Num end )- SUM(case when BizType='S' then MONTH1Num end )-SUM(case when BizType='I' then MONTH1Num end ) PanDianFROM t_testWHERE Model_No like 'iphone4s%'OR WHERE Model_No like 'v480%'GROUP BY BigCategory,SmallCategory,Model_No;我这段代码为什么老是报错,用的是mysql数据库
查看完整描述

2 回答

?
红糖糍粑

TA贡献1815条经验 获得超6个赞

你的代码 有两个 where

WHERE Model_No like 'iphone4s%'
OR WHERE Model_No like 'v480%'

改成这样

WHERE Model_No like 'iphone4s%'
OR Model_No like 'v480%'

查看完整回答
反对 回复 2021-06-07
?
幕布斯7119047

TA贡献1794条经验 获得超8个赞

select * from mm where name like '王%' or name like '张%' or name like '李%'
或者
select name from table where name like '王%'
union
select name from table where name like '张%'
union
select name from table where name like '李%'




查看完整回答
反对 回复 2021-06-07
  • 2 回答
  • 0 关注
  • 393 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信