mysql - How to combine column from other table -


i have created 2 temporary tables:

--------------      ------------------ | withlabfee |      | without lab fee| --------------      ------------------   |   6        |      |       3        | --------------      ------------------ 

my code returned following result single column.

------------------------------- | withlabfee , without lab fee| -------------------------------  |   6        ,      3         | ------------------------------ 

my attempted code below

    drop table if exists withlabfee;     create temporary table withlabfee(labfee1 int);     insert withlabfee         select count(*)         course_relation         lab_fee not null;      drop table if exists withoutlabfee;     create temporary table withoutlabfee(labfee2 int);     insert withoutlabfee         select count(*)         course_relation         lab_fee null;      select concat(labfee1,',',labfee2) `with lab fee , without lab fee`     withlabfee, withoutlabfee;      drop table labfee;     drop table withoutlabfee; 

how combine column temp table withlabfee , withoutlabfee 1 table 2 columns below:

------------------------------- | withlabfee | without lab fee| -------------------------------  |   6        |      3         | ------------------------------- 

any helps appreciated!

solution without temporary tables:

select   sum(lab_fee not null) 'with lab fee',   sum(lab_fee null) 'without lab fee'    course_relation 

Comments