SELECT
YEAR (date) AS YEAR,
MONTH (date) AS MONTH,
IF (
level_id = 'L1',
count(level_id),
0
) AS L1,
IF (
level_id = 'L2',
count(level_id),
0
) AS L2,
IF (
level_id = 'L3',
count(level_id),
0
) AS L3
FROM
stak
GROUP BY
date
在执行上述查询之前:
在Above查询执行完所需结果后: