mysql - SQL- SELECT something AS with multiple where -
i'd output of sql query appear below.
|count_a|count_b|count_c|count_d|
| 2 | 3 | 4 | 5 |
the current output using union is
|count_a|
2
3
4
5
select count(ins_name) count_a table_a ins_name in ( select ins_name table_b ins_id in (select ins_map_id ten_to_inst_map t_in_map_id = (select t_id tw tnam = 'abc'))) , t_date between '2015-01-01' , '2015-07-01' , ins_name not 'x%pr%' , ins_name 'x%y%' , and ins_name not 'x%y%z' union select count(ins_name) count_b table_a ins_name in ( select ins_name table_b ins_id in (select ins_map_id t_in_map t_in_map_id = (select t_id tw tnam = 'abc'))) , t_date between '2015-01-01' , '2015-07-01' , ins_name not 'x%pr%' , ins_name 'x%as%' union select count(ins_name) count_c table_a ins_name in ( select ins_name table_b ins_id in (select ins_map_id t_in_map t_in_map_id = (select t_id tw tnam = 'abc'))) , t_date between '2015-01-01' , '2015-07-01' , ins_name not 'x%pr%' , ins_name 'x%dfg%' union select count(ins_name) count_d table_a ins_name in ( select ins_name table_b ins_id in (select ins_map_id t_in_map t_in_map_id = (select t_id tw tnam = 'abc'))) , t_date between '2015-01-01' , '2015-07-01' , ins_name not 'x%pr%' , ins_name 'x%y%z'
could please ask someone's here. not @ please.
select t1.count_a, t2.count_b,t3.count_c,t4.count_d (select count(ins_name) count_a table_a ins_name in ( select ins_name table_b ins_id in (select ins_map_id ten_to_inst_map t_in_map_id = (select t_id tw tnam = 'abc'))) , t_date between '2015-01-01' , '2015-07-01' , ins_name not 'x%pr%' , ins_name 'x%y%' , and ins_name not 'x%y%z') t1 , (select count(ins_name) count_b table_a ins_name in ( select ins_name table_b ins_id in (select ins_map_id t_in_map t_in_map_id = (select t_id tw tnam = 'abc'))) , t_date between '2015-01-01' , '2015-07-01' , ins_name not 'x%pr%' , ins_name 'x%as%') t2 , (select count(ins_name) count_c table_a ins_name in ( select ins_name table_b ins_id in (select ins_map_id t_in_map t_in_map_id = (select t_id tw tnam = 'abc'))) , t_date between '2015-01-01' , '2015-07-01' , ins_name not 'x%pr%' , ins_name 'x%dfg%') t3 , (select count(ins_name) count_c table_a ins_name in ( select ins_name table_b ins_id in (select ins_map_id t_in_map t_in_map_id = (select t_id tw tnam = 'abc'))) , t_date between '2015-01-01' , '2015-07-01' , ins_name not 'x%pr%' , ins_name 'x%y%z') t4
Comments
Post a Comment