update set where exists 多表更新 在mssql、MySQL、Oracle中分别用法

时间:2022-07-29 00:29:34
MySQL:
UPDATE ChgCfm t1
INNER JOIN tb_dz_file t2 ON t1.ID = t2.ID
SET t1.CfmStatus =0
WHERE t1.CmfFile ='' SQLserver: UPDATE t1 SET t1.CfmStatus=0 FROM ChgCfmRcd t1
INNER JOIN tb_dz_file t2 on t1.RcdID=t2.DzID WHERE t1.CmfFile='' UPDATE t1 SET t1.CfmStatus=0 FROM ChgCfmRcd t1
WHERE EXISTS ( SELECT 1 FROM tb_dz_file t2 WHERE t1.RcdID=t2.DzID AND t1.CmfFile=''); Oracle: UPDATE ChgCfmRcd t1 SET t1.CfmStatus=0
WHERE EXISTS ( SELECT FROM tb_dz_file t2 WHERE t1.RcdID=t2.DzID AND t1.CmfFile='');
组合一个数:
 SELECT  CONCAT(SUBSTRING('0105',1,2),'01')