选择:
SELECT pr.predmet AS naziv_predmeta,
pr.protustranka_naziv AS protustranka
WHERE pr.datetime > Date_add (Now(), INTERVAL 24 hour)
我一直在
1064 - 您的SQL语法出错;检查与您的MySQL服务器版本对应的手册,以便在'WHERE pr.datetime>附近使用正确的语法; Date_add(Now(),INTERVAL 24小时)'at line> 3
表格结构:
protustranka_naziv varchar(255)
predmet varchar(255)
datetime datetime
编辑:好的,所以第一步是添加FROM子句/ facepalm。但问题是,我仍然收到错误消息。这是查询:
SELECT pr.predmet AS naziv_predmeta, pr.protustranka_naziv AS protustranka
FROM ou_predmeti
WHERE pr.datetime > DATE_ADD( NOW( ) , INTERVAL 24 HOUR )
LIMIT 0 , 30
这是消息:
1064 - 您的SQL语法出错;查看与MySQL服务器版本对应的手册,以便在第4行的'LIMIT 0,30'附近使用正确的语法
EDIT2:我再次错过了,应该是FROM ou_predmeti pr
答案 0 :(得分:1)
您忘记了FROM
条款
SELECT pr.predmet AS naziv_predmeta,
pr.protustranka_naziv AS protustranka
FROM ????
WHERE pr.datetime > Date_add (Now(), INTERVAL 24 hour)
答案 1 :(得分:1)
您错过了重要的FROM
条款:
SELECT pr.predmet AS naziv_predmeta,
pr.protustranka_naziv AS protustranka
FROM <TABLE-NAME-HERE> AS pr
WHERE pr.datetime > Date_add (Now(), INTERVAL 24 hour)
答案 2 :(得分:1)
FROM
子句
SELECT pr.predmet AS naziv_predmeta,
pr.protustranka_naziv AS protustranka
FROM your_table AS pr
WHERE pr.datetime > Date_add (Now(), INTERVAL 24 hour)