select
a.HINCD as 商品CD
,a.KANRICD as 管理CD
,GI19TM_002.calcdy as 出荷日
,a.KIKISCD as 期层
,a.OLDSKADY as 元出荷日
,ISNULL(a.SKAKBN,0) as 出荷区分
,ISNULL(a.SKASRY,0) as 出荷当日数
from
(select HINCD as 商品CD
,KANRICD as 管理CD
,GI19TM_002.calcdy as 出荷日
,KIKISCD as 期层
,OLDSKADY as 元出荷日
,SKAKBN as 出荷区分
,sum(SKASRY) as 出荷当日数
from GI19TW_104 as a
where a.SKAKBN ='0'
group by a.HINCD,a.KANRICD,a.KIKISCD,GI19TM_002.calcdy,a.OLDSKADY,a.SKAKBN)
right outer join GI19TM_002 on
a.SKADY=GI19TM_002.calcdy
where
GI19TM_002.KASHOCD='021'
and GI19TM_002.KASHOKBN='2'
求大虾们帮着看看 这条语句到底哪错了
------解决方案--------------------
- SQL code
select a.HINCD as 商品CD,a.KANRICD as 管理CD,GI19TM_002.calcdy as 出荷日,a.KIKISCD as 期层,a.OLDSKADY as 元出荷日,ISNULL(a.SKAKBN,0) as 出荷区分,ISNULL(a.SKASRY,0) as 出荷当日数from (select HINCD as 商品CD,KANRICD as 管理CD,GI19TM_002.calcdy as 出荷日,KIKISCD as 期层,OLDSKADY as 元出荷日,SKAKBN as 出荷区分,sum(SKASRY) as 出荷当日数from GI19TW_104 as a where a.SKAKBN ='0'group by a.HINCD,a.KANRICD,a.KIKISCD,GI19TM_002.calcdy,a.OLDSKADY,a.SKAKBN)t--别名right outer join GI19TM_002 ona.SKADY=GI19TM_002.calcdy where GI19TM_002.KASHOCD='021'and GI19TM_002.KASHOKBN='2'
------解决方案--------------------
- SQL code
select a.商品CD,a.管理CD,GI19TM_002.calcdy as 出荷日,a.期階層,a.元出荷日,ISNULL(a.出荷区分,0) as 出荷区分,ISNULL(a.出荷当日数,0) as 出荷当日数from (select HINCD as 商品CD,KANRICD as 管理CD,KIKISCD as 期階層,OLDSKADY as 元出荷日,SKAKBN as 出荷区分,sum(SKASRY) as 出荷当日数,SKADYfrom GI19TW_104 where SKAKBN ='0'group by HINCD,KANRICD,KIKISCD,OLDSKADY,SKAKBN,SKADY) as a right outer join GI19TM_002 ona.SKADY=GI19TM_002.calcdy where GI19TM_002.KASHOCD='021'and GI19TM_002.KASHOKBN='2'试试行不行
------解决方案--------------------
SKADY哪来的,不是OLDSKADY么?