以下 sql 更新查询有什么问题?
what is wrong with below sql update query?
我正在尝试运行以下查询
update IGNORE cs
set Value = '20934820843'
from admin.ConfigSupplemental as cs,
admin.Config as cc
where cs.ConsoleConfigID = cc.ID
and cs.Name = 'GetTime' and cc.Ctid = 200
我遇到以下异常:
Check the manual that corresponds to your MariaDB server version for
the right syntax to use near ConfigSupplemental as cs
我也尝试了下面的方法,但我得到了同样的错误。
update IGNORE cs
set cs.Value = '2039482094380'
from admin.ConfigSupplemental cs
join admin.Config cc on
cc.ID = cs.ConsoleConfigID
where cs.Name = "GetTime"
and cc.Ctid = 200
你在 ignore 和 (from) table 名称之后有一个 cs 别名在错误的位置
更新中的 from 不存在。
可能是这样
update IGNORE
admin.ConfigSupplemental as cs
inner join admin.Config as cc on ( cs.ConsoleConfigID = cc.ID and cs.Name = 'GetTime' and cc.Ctid = 200)
set Value = '20934820843'
;
下面是 MySQL 和 MariaDB 的正确语法:
update admin.ConfigSupplemental cs join
admin.Config cc
on cs.ConsoleConfigID = cc.ID
set Value = '20934820843'
where cs.Name = 'GetTime' and cc.Ctid = 200;
如果您真的想要,可以在 ignore
中添加。
我正在尝试运行以下查询
update IGNORE cs
set Value = '20934820843'
from admin.ConfigSupplemental as cs,
admin.Config as cc
where cs.ConsoleConfigID = cc.ID
and cs.Name = 'GetTime' and cc.Ctid = 200
我遇到以下异常:
Check the manual that corresponds to your MariaDB server version for the right syntax to use near ConfigSupplemental as cs
我也尝试了下面的方法,但我得到了同样的错误。
update IGNORE cs
set cs.Value = '2039482094380'
from admin.ConfigSupplemental cs
join admin.Config cc on
cc.ID = cs.ConsoleConfigID
where cs.Name = "GetTime"
and cc.Ctid = 200
你在 ignore 和 (from) table 名称之后有一个 cs 别名在错误的位置 更新中的 from 不存在。
可能是这样
update IGNORE
admin.ConfigSupplemental as cs
inner join admin.Config as cc on ( cs.ConsoleConfigID = cc.ID and cs.Name = 'GetTime' and cc.Ctid = 200)
set Value = '20934820843'
;
下面是 MySQL 和 MariaDB 的正确语法:
update admin.ConfigSupplemental cs join
admin.Config cc
on cs.ConsoleConfigID = cc.ID
set Value = '20934820843'
where cs.Name = 'GetTime' and cc.Ctid = 200;
如果您真的想要,可以在 ignore
中添加。