简单的date_sub()mySQL查询无法执行

时间:2014-05-24 12:59:47

标签: mysql sql

这里的查询我试图执行无济于事

SELECT 
    p.*, c.* 
FROM 
    `players` AS `p` 
INNER JOIN 
    `price_checks` AS `c` 
ON 
    `c`.`resourceId` = `p`.`Player_Resource` 
WHERE 
    DATE(`c`.`timecheck`) = DATE(DATE_SUB(NOW(), INTERVAL 1 DAY) 
AND 
    `p`.`Players_id` = '16892'

我显示的错误如下

SELECT p.*, c.* FROM `players` AS `p` INNER JOIN `price_checks` AS `c` ON `c`.`resourceId` = `p`.`Player_Resource` WHERE DATE(`c`.`timecheck`) = DATE(DATE_SUB(NOW() , INTERVAL 1 DAY) AND `p`.`Players_id` = '16892' 
LIMIT 0, 25 
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 0, 25' at line 2 

它说我附加了LIMIT语法?有什么理由可以失败吗?

1 个答案:

答案 0 :(得分:2)

您遗失了)

     DATE(`c`.`timecheck`) = DATE(DATE_SUB(NOW(), INTERVAL 1 DAY) )
                                                                  ^--here

原因: mysql正在寻找)然后它来LIMIT)还没有来,所以他很惊讶为什么LIMIT现在来了:),然后它告诉你ayyy,Heyy !!是否缺少LIMIT右边的东西:)。 ?