gpt4 book ai didi

mysql - 数据库错误 1064

转载 作者:行者123 更新时间:2023-11-29 08:08:29 26 4
gpt4 key购买 nike

请问谁能告诉我的 sql 请求出了什么问题吗?

这是一个结果:

数据库错误:无效的 SQL:

SELECT 
COUNT(DISTINCT i.item_id)
FROM
(
(
va_items i
INNER JOIN va_items_categories ic
ON i.item_id = ic.item_id
)
INNER JOIN va_categories c
ON c.category_id = ic.category_id
)
WHERE i.is_showing = 1
AND i.is_approved = 1
AND (
(
i.hide_out_of_stock = 1
AND i.stock_level > 0
)
OR i.hide_out_of_stock = 0
OR i.hide_out_of_stock IS NULL
)
AND (
i.language_code IS NULL
OR i.language_code = ''
OR i.language_code = 'en'
)
AND i.sites_all = 1
AND i.guest_access_level & 2
AND (
ic.category_id = 53
OR c.category_path LIKE '0,48,53,%'
) (i.price > 0
AND i.is_sold = 0)

这是错误:

MySQL Error: 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 '(i.price > 0 AND i.is_sold = 0)' at line 1

A 无法编写完整的请求,因为有一个巨大的脚本,该脚本包含大量逻辑。

请帮帮我

最佳答案

在尝试 (i.price > 0 AND i.is_sold = 0) 之前,您缺少 AND/OR 运算符

AND (i.price > 0     AND i.is_sold = 0)

OR (i.price > 0     AND i.is_sold = 0)

关于mysql - 数据库错误 1064,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22228113/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com