程序员人生 网站导航

sql 两张表关联修改数据

栏目:互联网时间:2014-11-24 08:12:46

Hr_DepartPlanWeek 部门周计划表:DepartMent部门名称,DepartMentID部门ID。

g_group部门表:gname部门名称,gid部门id

根据DepartMentID管理g_group表修改DepartMent

update Hr_DepartPlanWeek set DepartMent=t.gname from (select gname,gid from g_group left join Hr_DepartPlanWeek on g_group.GId=Hr_DepartPlanWeek.DepartMentID )t where t.GId=Hr_DepartPlanWeek.DepartMentID



------分隔线----------------------------
------分隔线----------------------------

最新技术推荐