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 ) PanDian
FROM t_test
WHERE 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 ) PanDian
FROM t_test
WHERE Model_No like 'iphone4s%'
OR WHERE Model_No like 'v480%'
GROUP BY BigCategory,SmallCategory,Model_No;
我这段代码为什么老是报错,用的是mysql数据库
红糖糍粑
幕布斯7119047
相关分类