update dbo.m_role_fun a
set role_code = b.rsc
from (select rsc, fun_code from dbo.m_fun) b
where a.fun_code = b.fun_code

几个开源数据库的连接更新的写法都不同,比较下来还是Postgres优雅点。

回顾下MySQL写法:

update A 
join B on A.x = B.x
set A.xx = B.xx

Firebird 写法:

MERGE INTO  target [[AS]  target-alias ]
USING  source [[AS]  source-alias ]
ON  join-condition
WHEN MATCHED THEN UPDATE SET  colname =  value [,  colname =  value ...]
WHEN NOT MATCHED THEN INSERT [( <columns> )] VALUES ( <values> )

 

相关文章:

  • 2021-09-24
  • 2021-12-16
  • 2021-05-24
  • 2021-05-30
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-11
  • 2021-06-29
  • 2021-11-17
  • 2022-03-07
  • 2021-07-05
相关资源
相似解决方案