1、SQLSERVER中的写法:
--更新上传点表数据
update ID_MASTER set ONCALL_ID=Tb_Points.ONCALL_ID,
ServerName=Tb_Points.ServerName,
SISCode = Tb_Points.SISCode,
LOC_ID = Tb_Points.JZCode,
Unit= Tb_Points.Unit,
Description = Tb_Points.PointName
from Tb_Points
where ID_MASTER.ServerName=Tb_Points.ServerName and
ID_MASTER.SISCode=Tb_Points.SISCode
--更新开关量数据
update BUFFER_DIGI set CTR_VALUE=Tb_Points.RealValue,
VALUE_TIME=Tb_Points.InputDate
from Tb_Points,ID_MASTER
where BUFFER_DIGI.ONCALL_ID=ID_MASTER.ONCALL_ID and
BUFFER_DIGI.TRANS_ID = ID_MASTER.TRANS_ID and
BUFFER_DIGI.LOC_ID = ID_MASTER.LOC_ID and
ID_MASTER.ServerName=Tb_Points.ServerName and
ID_MASTER.SISCode=Tb_Points.SISCode
2、ORACLE中的写法
--更新机组信息
update tb_pointconfig a set (GENERATORID)=
(select decode(b."GroupId",1,13,2,14) as JZ
from sssj b where a.uploadid=b."Id" and a.factoryid=9 and (b."GroupId"=1 or b."GroupId"=2))
--使用MERGE方法更新数据
MERGE INTO tb_realtimedatavalue a
USING tb_pointconfig b
ON (a.fid = b.factoryid and a.uploadid=b.uploadid)
WHEN MATCHED THEN
UPDATE SET a.pointid = b.id
WHERE a.fid=13