我的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