select a.MonthCode,b.STDskucode,a.skucode,c.sku_cn,
case when a,Channel='Omni KC' and a.SubChannel='NCA' then 'NCA' when a.Channel='Omni KC' and a.SubChannel<>'NCA' then 'NKC' else a.Channel end as DPChannel,
sum(a.GSV)/1000 as GSV,
0 as NIV
from DP_Forecast as a
inner join MD_STDSKU as b on b.stdskucode=a.stdskucode
inner join md_sku as c on a.skucode=c.skucode
group by select a.MonthCode,b.STDskucode,a.skucode,c.sku_cn,
case when a,Channel='Omni KC' and a.SubChannel='NCA' then 'NCA' when a.Channel='Omni KC' and a.SubChannel<>'NCA' then 'NKC' else a.Channel end
union all
select d.MonthCode,b.STDskucode,d.skucode,c.sku_cn,
case when d.DivisionDesc='Omni KC' and d.RegionDesc='NCA' then 'NCA' when d.DivisionDesc='Omni KC' and d.RegionDesc<>'NCA' then 'NKC' else d.DivisionDesc end as DPChannel ,
sum(d.GSV)/1000 as GSV,
sum(d.NIV)/1000 as NIV
from DW_PrimarySales as d
inner join MD_STDSKU as b on b.stdskucode=d.stdskucode
inner join md_sku as c on d.skucode=c.skucode
where d.MonthCode between '2023_M01' and '2023_M06'
group by d.MonthCode,b.STDskucode,d.skucode,c.sku_cn,
case when d.DivisionDesc='Omni KC' and d.RegionDesc='NCA' then 'NCA' when d.DivisionDesc='Omni KC' and d.RegionDesc<>'NCA' then 'NKC' else d.DivisionDesc end
报错信息如下
消息 4145,级别 15,状态 1,第 18 行
在应使用条件的上下文(在 ',' 附近)中指定了非布尔类型的表达式。
消息 4145,级别 15,状态 1,第 27 行
在应使用条件的上下文(在 ',' 附近)中指定了非布尔类型的表达式。
完成时间: 2023-07-30T18:13:56.2767725+08:00
```sql
```