select Cname,Advance,Bill,Refund from (select cname,r.Amount,R.PaymentType from ReceiptDetails r )as sourcetable Pivot(sum(Amount)for PaymentType in([Advance],[Bill],[Refund])) as PivotTable
select Cname,sum(cb.totalandvat) from Customer_Bill
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)