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%'
幕布斯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 '李%'
添加回答
举报
0/150
提交
取消