mysql - 如何选择时间戳日期 > 或 < 其他时间戳的所有记录?

标签 mysql sql syntax-error

比较
时间戳 pubDate = rs.getTimestamp("pubDate");
与此查询表中的所有其他时间戳:

get * from items where pubDate<?

抛出错误:

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'get * from items where 
pubDate<'2015-05-04 18:26:00'' at line 1

正确的语法是什么?

最佳答案

用于从表中检索行的 SQL 语法是 select,而不是 get:

SLEECT * FROM items WHERE pubDate < ?

关于mysql - 如何选择时间戳日期 > 或 < 其他时间戳的所有记录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30059821/

相关文章:

php - 在 mySQL 中从所有父项中选择所有子项

mysql - 通过插入来自另一个表的外键计数来更新表

mysql - 为特定表逐步更改 AUTO_INCRMENT 属性的 n 值

mysql - 如果删除了父外键,则将子表中的外键列设置为空

php - 购物车和库存管理

MySQL更新错误的列

sql - 当语法正确时,为什么PostgreSQL语句在单引号上失败?

let ... in 的 OCaml 语法错误

powershell - 如何在Powershell中逐字读取文件?

php - 错误 INSERT INTO MySQL 表