W
wsq547
Unregistered / Unconfirmed
GUEST, unregistred user!
SELECT Provider_Info.aID as ghsid,Provider_Info.code,Provider_Info.shortname,
Sum(jhsl) as zjhsl, Sum(jhzpsl) as zjhzpsl,(zjhsl+zjhzpsl) as zjhslTotal,Sum(yfSum) as zyfSum,
Sum(payupSum) as zpayupSum,(zyfSum-zpayupSum) as zwillpaySum, Sum(thsl) as zthsl, Sum(thzpsl) as zthzpsl,
(zthsl+zthzpsl) as zthslTotal,Sum(ysSum) as zysSum, Sum(gatherSum) as zgatherSum,(zysSum-zgatherSum)
as zwillGatherSum, Sum(zjhxe) as zjhxe,Sum(zthxe) as zthxe
From
(SELECT Provider_Info.aID,Provider_Info.code,Provider_Info.shortname,Sum(JHBT.jhshl) as jhsl,
Sum(JHBT.zpshl) as jhzpsl,(jhsl+jhzpsl) as jhslTotal,Sum(JHBT.jhje) as yfSum, Sum(JHBT.paidup_money) as payupSum,
(yfSum-payupSum) as willpaySum, 0 as thsl,0 as thzpsl,0 as thslTotal,0 as ysSum,0 as gatherSum,0 as willGatherSum,
Sum(jhxe) as zjhxe,0 as zthxe
FROM Provider_Info LEFT JOIN JHBT ON Provider_Info.aID = JHBT.Provider_aID
--WHERE JHBT.jhrq between :sd And :ed
Group by Provider_Info.aID, Provider_Info.code, Provider_Info.shortname Union
SELECT Provider_Info.aID,Provider_Info.code,Provider_Info.shortname,0 as jhsl,0 as jhzpsl,0 as jhslTotal,
0 as yfSum,0 as payupSum,0 as willpaySum, Sum(THBT.thshl) as thsl, Sum(THBT.zpshl) as thzpsl,
(thsl+thzpsl) as thslTotal,Sum(THBT.thje) as ysSum, Sum(THBT.paidup_money) as gatherSum,
(ysSum-gatherSum) as willGatherSum, 0 as zjhxe,Sum(thxe) as zthxe
FROM Provider_Info LEFT JOIN THBT ON Provider_Info.aID = THBT.Provider_aID
--WHERE THBT.thrq between :sdc And :edc
Group by Provider_Info.aID, Provider_Info.code, Provider_Info.shortname)
Group by Provider_Info.aID, Provider_Info.code, Provider_Info.shortname
在SQL server 中运行时,他会提示关键字Group附近存在语法错误,我找了半天也不知道什么原因,请高手指点一二招,小弟,先在这里谢谢了!
Sum(jhsl) as zjhsl, Sum(jhzpsl) as zjhzpsl,(zjhsl+zjhzpsl) as zjhslTotal,Sum(yfSum) as zyfSum,
Sum(payupSum) as zpayupSum,(zyfSum-zpayupSum) as zwillpaySum, Sum(thsl) as zthsl, Sum(thzpsl) as zthzpsl,
(zthsl+zthzpsl) as zthslTotal,Sum(ysSum) as zysSum, Sum(gatherSum) as zgatherSum,(zysSum-zgatherSum)
as zwillGatherSum, Sum(zjhxe) as zjhxe,Sum(zthxe) as zthxe
From
(SELECT Provider_Info.aID,Provider_Info.code,Provider_Info.shortname,Sum(JHBT.jhshl) as jhsl,
Sum(JHBT.zpshl) as jhzpsl,(jhsl+jhzpsl) as jhslTotal,Sum(JHBT.jhje) as yfSum, Sum(JHBT.paidup_money) as payupSum,
(yfSum-payupSum) as willpaySum, 0 as thsl,0 as thzpsl,0 as thslTotal,0 as ysSum,0 as gatherSum,0 as willGatherSum,
Sum(jhxe) as zjhxe,0 as zthxe
FROM Provider_Info LEFT JOIN JHBT ON Provider_Info.aID = JHBT.Provider_aID
--WHERE JHBT.jhrq between :sd And :ed
Group by Provider_Info.aID, Provider_Info.code, Provider_Info.shortname Union
SELECT Provider_Info.aID,Provider_Info.code,Provider_Info.shortname,0 as jhsl,0 as jhzpsl,0 as jhslTotal,
0 as yfSum,0 as payupSum,0 as willpaySum, Sum(THBT.thshl) as thsl, Sum(THBT.zpshl) as thzpsl,
(thsl+thzpsl) as thslTotal,Sum(THBT.thje) as ysSum, Sum(THBT.paidup_money) as gatherSum,
(ysSum-gatherSum) as willGatherSum, 0 as zjhxe,Sum(thxe) as zthxe
FROM Provider_Info LEFT JOIN THBT ON Provider_Info.aID = THBT.Provider_aID
--WHERE THBT.thrq between :sdc And :edc
Group by Provider_Info.aID, Provider_Info.code, Provider_Info.shortname)
Group by Provider_Info.aID, Provider_Info.code, Provider_Info.shortname
在SQL server 中运行时,他会提示关键字Group附近存在语法错误,我找了半天也不知道什么原因,请高手指点一二招,小弟,先在这里谢谢了!