gpt4 book ai didi

mysql - PDO异常 : SQLSTATE[42000]

转载 作者:行者123 更新时间:2023-11-29 15:44:01 28 4
gpt4 key购买 nike

Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error oraccess violation: 1064 You have an error in your SQL syntax; check themanual that corresponds to your MySQL server version for the rightsyntax to use near 'AND Sold = 0 ORDER BY Date DESC,Count DESC,PriceASC' at line 14 in {path} on line 1026

查询:

select * from (numbers t inner join (select distinct n.Number
from (
select 1 start union all select 2 union all select 3 union all
select 4 union all select 5
) s cross join numbers n
where
left(substring(n.Number, s.start, 2), 1) <> right(substring(n.Number, s.start, 2), 1)
and
n.Number like concat(
'%', substring(n.Number, s.start, 2),
substring(n.Number, s.start, 2),
substring(n.Number, s.start, 2),
substring(n.Number, s.start, 2), '%'
)) n on n.Number = t.Number) AND Sold = 0 ORDER BY Date DESC,Count DESC,Price ASC

最佳答案

您的数字 t .... 和 SOLD = 0 之前的数字似乎有误

select * 
from numbers t
inner join (select distinct n.Number
from (
select 1 start
union all select 2
union all select 3
union all select 4
union all select 5
) s
cross join numbers n
where
left(substring(n.Number, s.start, 2), 1) <> right(substring(n.Number, s.start, 2), 1)
and
n.Number like concat(
'%', substring(n.Number, s.start, 2),
substring(n.Number, s.start, 2),
substring(n.Number, s.start, 2),
substring(n.Number, s.start, 2), '%'
)) n on n.Number = t.Number AND Sold = 0
ORDER BY Date DESC,Count DESC,Price ASC

无论如何,请检查几个嵌套子查询是否真的是您需要的

关于mysql - PDO异常 : SQLSTATE[42000],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57271419/

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