我有一个这样的mysql查询
SELECT s.end_date_time AS Finishtime
FROM auctions_search AS s
WHERE end_date_time >NOW() + INTERVAL 3 HOUR;
所以我需要把它放到php中我试试这样
$aToday = date("Y-m-d H:i:s");
$aExpireAuctionTime = DBC::$slave->selectAssoc("
SELECT
s.end_date_time AS FinisDate
FROM
{$this->sDBName_Auction}.{$this->sTBLName_Auctions_Search} AS s
WHERE
s.end_date_time >{$aToday} + INTERVAL 3 HOUR
");
但给我错误
“您的 SQL 语法有错误;请查看与您的 MySQL 服务器版本相对应的手册,了解在 '08:53:24 + INTERVAL 3 HOUR' 附近使用的正确语法
end_date_time
列存储商店上列出的项目的结束日期
所以我需要选择一个结束不超过+3的项目
例如,我们有结束的记录
- 2013-08-15 09:51:38
- 2013-08-15 10:56:40
- 2013-08-29 18:56:00
- 2013-08-19 12:56:32
当前时间是 2013-08-15 08:51:38
所以我需要选择
- 2013-08-29 18:56:00
- 2013-08-19 12:56:32
因为另一个将在 3 小时后完成
也许查询应该我喜欢
select
s.end_date_time
from
auctions_search AS s
where
true
and s.start_date_time <= 3