gpt4 book ai didi

MYSQL 今天之前的日期

转载 作者:太空宇宙 更新时间:2023-11-03 10:54:02 25 4
gpt4 key购买 nike

这个问题已经被问了很多,但我发现答案似乎不起作用,所以我发帖在这里看看是否有人可以提供帮助。

我有这个

$sql = "SELECT SQL_CALC_FOUND_ROWS *, UNIX_TIMESTAMP(order_date) AS order_date, UNIX_TIMESTAMP(order_expected) AS order_expected
FROM orders WHERE DATE(order_expected) BETWEEN NOW() AND DATE_ADD(NOW() - INTERVAL 7 DAY);

$sql = "SELECT SQL_CALC_FOUND_ROWS *, UNIX_TIMESTAMP(order_date) AS order_date, UNIX_TIMESTAMP(order_expected) AS order_expected
FROM orders WHERE DATE(order_expected) BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL -7 DAY);

所有字段的名称都是正确的,但似乎都无法获得日期在今天之前 7 天内的值。

请帮忙。

伊恩

最佳答案

试试这个:-

SELECT SQL_CALC_FOUND_ROWS *, UNIX_TIMESTAMP(order_date) AS order_date, UNIX_TIMESTAMP(order_expected) AS order_expected
FROM orders
WHERE DATE(order_expected) BETWEEN DATE_ADD(NOW(), INTERVAL -7 DAY) AND NOW()

关于MYSQL 今天之前的日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22250432/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com