在MySQL中查詢(xún)前一天數(shù)據(jù)的方法有以下幾種:
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;