Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

T-SQL help on Total Cost

$
0
0

Hi i have a querey

select pr.PurchaseRequestId,prl.TotalCost,pr.DateRequested from dbo.PurchaseRequest as pr
left join dbo.PurchaseRequestLineItem as prl on pr.PurchaseRequestId=prl.PurchaseRequestId
where prl.TotalCost is not null

and the o/p is below

PurchaseRequestId    TotalCost    DateRequested
885                            100.00    2013-05-21 11:03:35.090
886                            100.00    2013-05-21 11:09:51.543
894                            100.00    2013-05-21 14:14:46.937
894                            250.00    2013-05-21 14:14:46.937
894                            720.00    2013-05-21 14:14:46.937
895                           1400.00    2013-06 -21 14:14:46.937

895                            200.00    2013-07-21 14:14:46.937

I would like the output to be sum of total cost and like below

PurchaseRequestId    TotalCost    DateRequested (month)
885                             100.00      MAY
886                             100.00      MAY
894                             2470.00    MAY
 

895                           1400.00     JUNE

895                            200.00     JULY

Please help me

Thanks


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>