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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -