mysql - 错误 1064 您的 SQL 语法有误

标签 mysql sql syntax-error

我们正在创建一个新网站,到目前为止没有遇到任何问题。我们仍然可以访问我们的管理面板,但昨天这条消息显示在主页的位置:

1064 - 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 ') AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2014-04-29 15:2' at line 1 SQL=

SELECT
  a.*,
  c.name as categoryname,
  c.id as categoryid,
  c.alias as categoryalias,
  c.params as categoryparams
FROM
  am4xy_k2_items as a
  LEFT JOIN am4xy_k2_categories c ON c.id = a.catid
WHERE
  a.published = 1
  AND a.access IN(1,1)
  AND a.trash = 0
  AND c.published = 1
  AND c.access IN(1,1)
  AND c.trash = 0
  AND a.catid IN()
  AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2014-04-29 15:25:15' )
  AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2014-04-29 15:25:15' )
ORDER BY a.created ASC
LIMIT 0, 16

有什么想法吗?

最佳答案

IN() 不能为空:

AND a.catid IN()

您需要添加缺失值或在没有缺失值时将其删除。

关于mysql - 错误 1064 您的 SQL 语法有误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23369045/

相关文章:

sql - 向表中添加一列,其默认值等于现有列的值

javascript - JavaScript 中缺少分号

sql - 这个查询有什么问题?双引号错误

mysql - 即使在 SELECT First 之后,双重请求也会重复数据库条目

php - 获取登录的用户数据

mysql - sql查询在join中按一进行分组

sql - 位图索引如何工作?

php - PHP解析/语法错误;以及如何解决它们

java - 如何查看/更改 MySQL 连接超时设置?

mysql - LOAD DATA LOCAL INFILE - 仅插入一行