I would like to find a way to update a table with the other 2 people, here's the scenario:
EmptyTbl: Content missing information (fname, lname, address) Info1Tbl & amp; Info2Tbl: Full InformationPlease refer to the SQL field for the table above.
The base on the phone number and it needs to update
EmptyTbl
Info1Tbl & amp; Please help with the query
Info2Tbl with the latest update information from these 2 tables.
try it
; Select cte (* info1tbl from union * select all * from info2tbl), select cte2 (* *, row_number () from cte2 (based on phone order by RTN), CTE) --select * Where rn = 1 update and set E.fname = cte2.fname, e.lname = cte2.lname, e.address = cte2.address from e.phone = cte2.phone on emptytbl e internal cte2 and where rn = 1
No comments:
Post a Comment