我想做个同比的数据集,但是总是报错。有没有大佬给我看看是啥情况呢 SELECT name,month,total_revenue , CONCAT(year, '-',IF(LENGTH(month) = 2, month, CONCAT('0', month)))as ym,concat(ifnull(round((a.total_revenue-b.total_revenue/b.total_revenue*100,2),0),"%") as '同比' FROM( SELECT name,year,month,total_revenue from `tourist_scenic_data` WHERE year BETWEEN left('${date1}',4) and left('${date2}',4), ${if(len(jq)==0,"","and name = '" +jq+ "'")} order by month asc) a LEFT JOIN ( SELECT name,year,month,total_revenue from `tourist_scenic_data`) b ON b.month = a.month and b.year = a.year-1 ORDER BY a.month asc WHERE a.ym BETWEEN '${date1}' and '${date2} |