我有如下查询:
UPDATE prog_fatt
SET fat_prg = (SELECT MAX(VALUE)
FROM (SELECT 0 AS VALUE
UNION
SELECT fat_prg - 1 AS VALUE) AS T1)
适用于SQL Server,但提供:
ERROR 1054 (42S22): Unknown column 'fat_prg' in 'field list'
MySQL上的错误,有没有办法让它在MySQL下运行?
答案 0 :(得分:2)
这在MySQL中无效,但你不需要它
UPDATE prog_fatt
SET fat_prg = greatest(fat_prg - 1, 0)
应该有用。