cursor.execute(f""" select a2 as eqid, avg(a5) as a5, avg(a6) as a6, avg(a7) as a7, FROM_UNIXTIME(( UNIX_TIMESTAMP(a.a4)-UNIX_TIMESTAMP(a.a4)%(10*60)),'yyyy-MM-dd HH:mm:ss') as dtime, from 【表名】 a where 【过滤条件】 group by a2,UNIX_TIMESTAMP(a.a4)-UNIX_TIMESTAMP(a.a4)%(10*60) order by a2,dtime """)