gpt4 book ai didi

mysql - SQL 语法错误 SelectWhere Like

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

我的 phpmyadmin 给我以下错误:

#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 '17, COL 19, COL 21, COL 23
FROM `table 1`
WHERE (COL 7
LIKE '%13%' OR COL ' at line 1

当我尝试这样调用时:

SELECT COL 17, COL 19, COL 21, COL 23 
FROM `table 1`
WHERE (COL 7
LIKE '%13%' OR COL 1
LIKE '%13%' OR COL 2
LIKE '%13%' OR COLE 3
LIKE '%13%')

我尝试了几个选项,但没有成功。我可能监督了一些东西,但找不到它。

最佳答案

尝试将列名(其中似乎有空格)放在单个反引号中:

SELECT `COL 17`, `COL 19`, `COL 21`, `COL 23`
FROM `table 1`
WHERE (`COL 7` LIKE '%13%' OR `COL 1` LIKE '%13%' OR `COL 2` LIKE '%13%'
OR `COL 3` LIKE '%13%')

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

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