用户y2025540(提问者)通过学习查询,mysql的代码形式简单如下(没有你那么复杂)
set @mycnt = 1;
SELECT a.play,b.Part_Aver FROM (
SELECT date_add(CURRENT_DATE(),interval @mycnt :=@mycnt - 1 day) as play from b_measure_copy1 limit 30
) a
LEFT JOIN
(SELECT B_DATE,Part_Aver FROM b_measure_copy1 WHERE DATE>=(CURRENT_DATE()-30)
)b ON a.play=b.DATE;