Sql server 关键字“AS”附近的语法不正确。在SQL Server中

Sql server 关键字“AS”附近的语法不正确。在SQL Server中,sql-server,Sql Server,我的SQL Server查询有问题: UPDATE latihan AS t1 , (SELECT Equipment, system_status, functloc FROM latihan WHERE system_status='ESTO') AS t2 SET t1.functloc = t2.functloc WHERE t1.supereq = t2.equipment 我只想更新基于supereq的functloc的设备上的f

我的SQL Server查询有问题:

UPDATE latihan AS t1 ,
       (SELECT Equipment, system_status, functloc 
        FROM latihan 
        WHERE system_status='ESTO') AS t2 
SET t1.functloc = t2.functloc
WHERE t1.supereq = t2.equipment
我只想更新基于supereq的functloc的设备上的functloc

错误是:

[Err]42000-[SQL Server]关键字“AS”附近的语法不正确。 42000-[SQL Server]关键字“AS”附近的语法不正确


我想你想要这样的东西:

update t1 set
  functloc = t2.functloc
from latihan t1
inner join (
  select Equipment, system_status, functloc
  from latihan
  where system_status='ESTO'
) t2 on t2.equipment = t1.supereq