我有一个查询需要返回 ShipDate 在一系列日期之间的记录。以下查询有效:
$query = "SELECT ECCustomerOrder.ShipDate,
ECCustomers.Customer,
ECCustomerOrder.PO,
ECCustomerOrder.TotalCases,
ECCustomerOrder.order_number
FROM ECCustomerOrder INNER JOIN ECCustomers ON ECCustomerOrder.ID = ECCustomers.ID
WHERE ECCustomerOrder.ShipDate >= $todayMinus";
$todayMinus 是脚本前面设置的一个 php 变量,它采用当前日期并减去 15 天。我无法上班的情况如下:
$query = "SELECT ECCustomerOrder.ShipDate,
ECCustomers.Customer,
ECCustomerOrder.PO,
ECCustomerOrder.TotalCases,
ECCustomerOrder.order_number
FROM ECCustomerOrder INNER JOIN ECCustomers ON ECCustomerOrder.ID = ECCustomers.ID
WHERE ECCustomerOrder.ShipDate BETWEEN $todayMinus AND $todayPlus";
此 SQL 查询返回 $todayMinus 和 $todayPlus 的 ShipDates 之间的记录的正确语法是什么?