php - MYSQL UNION : returning output of two columns. Need in rows -
i 2 outputs following
i need
*---------------* | cram | dbam | |---------------| |10000 | 1020 | *---------------*
query
select sum(netamount) 'cram' account typee = 'credit' union select sum(amount + scharge) 'dbam' account typee = 'debit' order `cram`
you can use case:
select sum(case when typee = 'credit' netamount else null end) cram, sum(case when typee = 'debit' (amount + scharge) else null end) dbam account
Comments
Post a Comment