简体   繁体   English

MySQL日期时间比较查询语法对我不起作用

[英]mysql datetime comparison query syntax not working for me

I have a very simple select query in mysql that involve a filter of the date column. 我在mysql中有一个非常简单的select查询,其中涉及date列的过滤器。 I simply cannot find where my errors is. 我根本找不到我的错误在哪里。 Here is the query and error message: 这是查询和错误消息:

SELECT * FROM temp WHERE date > '2013-12-27 03:12:14';
ERROR 1064 (42000): You have an error in your....blablabla...near '?date > '2013-12-27 03:12:14'' at line 1

the console wouldnt allow me to copy, but in my data structure, there is a field named "date", type is "datetime", Null is yes, Default Null. 控制台不允许我复制,但是在我的数据结构中,有一个名为“ date”的字段,类型为“ datetime”,Null为yes,Default Null。

Where did i go wrong? 我哪里做错了?

thanks a lot for the helps! 非常感谢您的帮助! [edit] here is a screenshot [编辑]这是截图

[update] As suggested, I have retyped the statement and it worked. [更新]如建议的那样,我重新输入了该语句,它起作用了。 Although it solved the issue, i am more confused than ever. 尽管它解决了问题,但我比以往更加困惑。 If someone could enlighten me, please do. 如果有人可以启发我,请这样做。 thank you all. 谢谢你们。

Try this query
SELECT * FROM temp WHERE date > date('2013-12-27 03:12:14');

Use backticks in date and check if it works 在日期中使用反引号,并检查其是否有效

select * from temp where date > '2013-12-27 03:12:14'; date选择* from date >'2013-12-27 03:12:14';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM