I've created table like that:
sim_mcc_mnc January February March ....
232-10 1234 4321 5678 (these numbers are number of records)
By naming each column manually:
SELECT
sim_mcc_mnc,
sum(year(time_utc)=2013 AND month(time_utc)=1) as 'January 2013',
sum(year(time_utc)=2013 AND month(time_utc)=2) as 'February 2013',
sum(year(time_utc)=2013 AND month(time_utc)=3) as 'March 2013',
sum(year(time_utc)=2013 AND month(time_utc)=4) as 'April 2013',
...
...
...
FROM
table
where
sim_mcc_mnc like '232-%' OR
sim_mcc_mnc is null
GROUP BY
sim_mcc_mnc
;
My question is. Is there any possibility to name these columns automatically? I've tried to use CONCAT, but it seems to me that you can't use any function after AS.
Is there any other possibility?