sql 兩張表關聯修改資料,sql兩張關聯資料

來源:互聯網
上載者:User

sql 兩張表關聯修改資料,sql兩張關聯資料

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)twhere t.GId=Hr_DepartPlanWeek.DepartMentID




在SQL中兩張表關聯更改,更改兩張表裡的資料?

..
 
sqlserver怎通過兩個表關聯,更改其中一表中某列的資料?

select 1,2,3,distinct(b),c from A inner join B where A.1=B.1 and A.2=B.b
 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.