原创

各数据库update select 写法记录

mysql:

update all_server_list t1 set t1.parentid = t2.id from (select all_server_list.id,all_server_list."server" from all_server_list) t2 where t1.tags = t2."server"

postgresql:

update all_server_list t1 set parentid = t2.id from (select all_server_list.id,all_server_list."server" from all_server_list) t2 where t1.tags = t2."server"

eg:

update t_1 t
set t_id = map.new_id
from t_map map
where t.t_id = map.old_id
and t.name = 'a'
正文到此结束
该篇文章的评论功能已被站长关闭
本文目录