为什么此查询不返回 2011 年和 2012 年的数据。谁能帮助我。提前致谢。
SELECT
country_code,
SUM(`attendance`) as k6_attendance,
count(*) as total_events ,
IF(MONTH(`session_date`)<5,YEAR(`session_date`),YEAR(`session_date`)+1) as YR2
FROM `v_knowledge_session` v
WHERE session_date >0
Group by YR2,country_code
HAVING YR2>(YEAR(NOW())-2) AND country_code='IN'
ORDER BY country_code,YR2;