gpt4 book ai didi

mysql - org.hibernate.exception.SQLGrammarException : could not execute query : Incorrect syntax near the keyword 'user'

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

我还有一个问题。它只在 MSSQL 服务器中给出:

select theme0_.id as id12_, theme0_.user as user12_, theme0_.theme as theme12_ 
from theme theme0_ where theme0_.user=1

此查询出现错误:

Incorrect syntax near the keyword 'user'.

但是查询在 MySQL 服务器中正确执行。请帮我。谢谢!!

最佳答案

那是因为 USERReserve WordSQL Server 中,需要在查询中使用方括号 [] 进行转义。

然而 MySQL Reserve Words 的情况并非如此

您的查询应类似于

select [id] as id12_, 
[user] as user12_,
[theme] as theme12_
from theme
where [user] = 1

关于mysql - org.hibernate.exception.SQLGrammarException : could not execute query : Incorrect syntax near the keyword 'user' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26828645/

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