select chargedeptId ,itemname ,count(itemname)as itemnamenum, sum(TotalPrice) as totalprice ,systype,chargeId,payer,UnitPrice,TotalPrice ,invoiceno from vw_HC_getChargeItem where systype=2 Group by chargeId
调试欢乐多
UnitPrice,TotalPrice ,invoiceno from vw_HC_getChargeItem where systype=2 Group by chargedeptId,itemname
from vw_HC_getChargeItem where systype=2 Group by chargeId,itemname,systype,chargeId,payer,UnitPrice,TotalPrice ,invoiceno
select chargedeptId ,itemname ,(select count(1) from vw_HC_getChargeItem where systype=2 and chargeId=a.chargeId) itemnamenum,
(select sum(TotalPrice) from vw_HC_getChargeItem where systype=2 and chargeId=a.chargeId) totalprice ,
systype,chargeId,payer,UnitPrice,TotalPrice ,invoiceno
from vw_HC_getChargeItem a where systype=2
chargedeptId ,itemname ,count(itemname)as itemnamenum, sum(TotalPrice) as totalprice ,systype,chargeId,payer,UnitPrice,TotalPrice ,invoiceno
from
vw_HC_getChargeItem
where
systype=2
Group by
chargeId,chargedeptId ,itemname ,totalprice ,systype,chargeId,payer,UnitPrice,TotalPrice ,invoiceno
select chargedeptId ,itemname ,count(itemname)as itemnamenum, sum(TotalPrice) as totalprice ,systype,chargeId,payer,
UnitPrice,TotalPrice ,invoiceno
from vw_HC_getChargeItem
where systype=2 Group by chargedeptId ,itemname ,systype,chargeId,payer,UnitPrice,TotalPrice ,invoiceno