K
kaithink
Unregistered / Unconfirmed
GUEST, unregistred user!
Select ...
,cQty=Sum(cQty),cAmt=Sum(cAmt_Dtl)
,jQty=Sum(jQty),jAmt=Sum(jAmt_Dtl)
,netQty=Sum(cQty)-Sum(jQty)
,netAmt=Sum(cAmt_Dtl)-Sum(jAmt_Dtl)
,AvgPrice=Case when Sum(cQty)-Sum(jQty)=0 then
Cast(0 as Float)
else
(Sum(cAmt_Dtl)-Sum(jAmt_Dtl)) / (Sum(cQty)-Sum(jQty))
From x1
Group by ItemId
"Sum(cQty)-Sum(jQty)"这个串在三处出现,是否会造成服务器将这个串执行三次呢
还是只执行一次,在其它两处会使用第一次计算的结果呢?
请教各位富翁!
,cQty=Sum(cQty),cAmt=Sum(cAmt_Dtl)
,jQty=Sum(jQty),jAmt=Sum(jAmt_Dtl)
,netQty=Sum(cQty)-Sum(jQty)
,netAmt=Sum(cAmt_Dtl)-Sum(jAmt_Dtl)
,AvgPrice=Case when Sum(cQty)-Sum(jQty)=0 then
Cast(0 as Float)
else
(Sum(cAmt_Dtl)-Sum(jAmt_Dtl)) / (Sum(cQty)-Sum(jQty))
From x1
Group by ItemId
"Sum(cQty)-Sum(jQty)"这个串在三处出现,是否会造成服务器将这个串执行三次呢
还是只执行一次,在其它两处会使用第一次计算的结果呢?
请教各位富翁!