如何在Update中使用2 Where条件

时间:2019-01-18 00:42:49

标签: sql sql-server

我有以下更新查询;

UPDATE service 
SET PathNameEn = (SELECT NameEn FROM service WHERE id = 430) + ' > '

我想添加另一个WHERE条件

WHERE id BETWEEN 430 AND 435

我尝试过:

UPDATE service 
SET PathNameEn = (SELECT NameEn FROM service 
                  WHERE id = 430 AND id BETWEEN 430 AND 435) + ' > '

但这没用

1 个答案:

答案 0 :(得分:4)

您要更新多行吗?

UPDATE service
    SET PathNameEn = (SELECT NameEn + ' > ' FROM service WHERE id = 430)
    WHERE id between 430 AND 435;