我在哪里把ORDER BYweight_record.date
在这个语句到fetchall()
到一个数组排序的最早日期到最近?
mycursor.execute(
"SELECT weight_record.date AS wr_date,
weight_record.weight AS wr_weight,
calorie_record.calories AS cr_calories
FROM weight_record
JOIN calorie_record ON weight_record.date = calorie_record.date
WHERE weight_record.username = %s
AND calorie_record.username = %s", (user, user))
谢谢。
从文档来看,ORDER BY
应该在WHERE
条款之后。