我正在编写一个我需要使用此代码的脚本:
UPDATE articles
SET name="Alianza oro rosa y diamante ",
desc="Alianza oro rosa y diamante "
LIMIT 0, 1
我该怎么做才能让它发挥作用?
答案 0 :(得分:0)
据我所知,limit子句只接受一个数字,而不是像select语句中那样的x,y格式。
UPDATE articles
SET name="Alianza oro rosa y diamante ",
desc="Alianza oro rosa y diamante "
LIMIT 1
答案 1 :(得分:0)
如果你省略0,
:
UPDATE articles
SET name = "Alianza oro rosa y diamante ",
description = "Alianza oro rosa y diamante "
LIMIT 1;
根据documentation,您无法在LIMIT
子句中添加偏移量。不幸的是,LIMIT在子查询中不起作用。
检查this Fiddle。
p.s。 :潜在解决方案(根据评论):
UPDATE articles
SET donttouch = false -- reset marker
WHERE donttouch = true;
UPDATE articles
SET donttouch = true
LIMIT 1; -- offset
UPDATE articles
SET name = "Alianza oro rosa y diamante ",
description = "Alianza oro rosa y diamante "
WHERE donttouch = false
LIMIT 1; -- number of entries
这很难使用附加列(Fiddle)。