查找对前一周总计的查询
当前日期
SELECT Sum(total_cost)AS "total"
FROM purchases
WHERE datetime >= Curdate();
本周
SELECT SUM(total_cost)as "total"
FROM purchases
WHERE datetime >= DATE_SUB(CURDATE(), INTERVAL 1 WEEK);
前一天
SELECT SUM(total_cost)AS "total"
FROM purchases
WHERE datetime >= DATE_SUB(CURDATE(), INTERVAL 1 DAY)
AND datetime <= CURDATE();
寻找与此类似的查询以计算前一周。似乎无法让它工作。