mysql中用like实现多条件模糊查询
SELECTBigCategory,SmallCategory,Model_No,1'yuefen',SUM(casewhenBizType='P'thenMONTH1N...
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数据库 展开
,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数据库 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询