mysql - sql query that produce the following result -


can tell me sql query(mysql) result following output table .

enter image description here

you're after pivot table query - although it's better perform basic aggregation in (my)sql , handle problems of display @ application level (e.g. bit of php).

a standard query might follows, although mysql supports shorthand deviations standard...

select date_format(date,'%m') month      , coalesce(sum(case when status = 'rahul' value end),0) rahul       , coalesce(sum(case when status = 'vijay' value end),0) vijay      , coalesce(sum(case when status = 'loki' value end),0) loki   my_table   group      month(date); 

Comments