I'm new to MySQL, on MSSQL exists the pivot function... i've been searching on how to do this in MySQL but stil don't get it. i have the following query:
select c001adusec as A, count(distinct c001numped) as B,
case month(d001fecpag) when 1 then 'ENE' when 2 then 'FEB' when 3 then 'MAR' when 4 then 'ABR' when 5 then 'MAY' end as C
FROM AT001 where year(d001fecpag)=2015 and c001cvecli='INDP3' and c001tipope=1
GROUP BY c001adusec,month(d001fecpag)
that gives me this result:
A B C
240 13 ENE
240 12 FEB
240 13 MAR
240 13 ABR
240 2 MAY
800 2 MAR
but i want it this way:
Mes 240 800
Ene 13 0
Feb 12 0
Mar 13 2
Abr 13 0
May 2 0
can anyone help me ??