在MySQL中查詢前一天數據的方法有以下幾種:
SELECT * FROM table_name WHERE DATE(date_column) = DATE_SUB(CURDATE(), INTERVAL 1 DAY);
SELECT * FROM table_name WHERE DATE(date_column) = DATE_ADD(CURDATE(), INTERVAL -1 DAY);
SELECT * FROM table_name WHERE DATEDIFF(date_column, CURDATE()) = -1;
SELECT * FROM table_name WHERE DATE(date_column) = CURDATE() - INTERVAL 1 DAY;