#1111 - Invalid use of group function in mysql
问题 I have a table M_DAILY with fields PS_DATE date, tp int, ep int, mp int, and have a working version of a user defined function nvl(x,y) which returns x if not null and y if x is null My MySQL query is- select sum(avg(case date_format(PS_DATE,'%Y') when '2005' then nvl(tp,0) else 0 end))tp, sum(avg(case date_format(PS_DATE,'%Y') when '2005' then nvl(ep,0) else 0 end)) ep, sum(avg(case date_format(PS_DATE,'%Y') when '2005' then nvl(mp,0) else 0 end)) mp from M_DAILY where PS_DATE >= date ('2005