php - MYSQL UNION : returning output of two columns. Need in rows -


i 2 outputs following

image of sql file get

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

Popular posts from this blog

python - Best design pattern for collection of objects -

go - serving up pdfs using golang -

python - django admin: changing the way a field (w/ relationship to another model) is submitted on a form so that it can be submitted multiple times -