I've query like thisSelect TrID, Amount, Sum(GrowthAmt) As Growth, 'PRINCIPAL' as mHead from GrowthMast where TrDesc ='Commitment' and AppMstID =@MyCode and PaidTag=1 Group by TrID, AmountUNION ALL Select TrID, SUM(Amount), Sum(GrowthAmt) As Growth , 'PRINCIPAL PAID' as mHead from GrowthMast where TrDesc ='Commitment withdrawal' and AppMstID =@MyCode and PaidTag=1 Group by TrID, AmountUNION ALL Select TrID, Amount, Sum(GrowthAmt) As Growth , 'GROWTH' as mHead from GrowthMast where TrDesc ='Growth' and AppMstID =@MyCode and PaidTag=1 Group by TrID, AmountUNION ALL Select TrID, Amount, Sum(GrowthAmt) As Growth , 'GROWTH PAID' as mHead from GrowthMast where TrDesc ='Growth withdrawal' and AppMstID =@MyCode and PaidTag=1 Group by TrID, Amount
It returns row likeTrID Amount Growth mHeadZ505893464 45000 0 PRINCIPALZ347456519 100000 0 PRINCIPALZ505893464 200 0 PRINCIPAL PAIDZ347456519 500 0 PRINCIPAL PAIDZ505893464 45000 900 GROWTHZ347456519 100000 8000 GROWTHZ347456519 300 0 GROWTH PAIDNow I need final output likeTrID, Amout where mHead ='PRINCIPAL',Amout where mHead ='PRINCIPAL PAID', Amount where mHead ='GROWTH PAID'Can anyone help?VB6/ASP.NET------------------------http://www.nehasoftec.com