Tuesday, 15 September 2015

mysql - find amount paid and pending -



mysql - find amount paid and pending -

i new bee in mysql db can help me getting ginven output current table .

please check given link table structur , output

use group by, sum, , case (or if):

select buyer, totalamount, paidamount, totalamount-paidamount balanceamount ( select buyer, sum(amount) totalamount, sum(case when paidstatus = 1 amount else 0 end) paidamount yourtable grouping buyer ) t

sample fiddle

mysql

No comments:

Post a Comment