A表中有一些欄位,其中有a1,對應為B表的b1,同時B表的b2對應C表的c1,然后使用C表的欄位去更新A表的除a1外其余欄位?
有沒有大佬幫忙看一下
uj5u.com熱心網友回復:
update A set (a2,a3)=(select c2,c3 from b,c where b.b2=c.c1 and b.b1=a.a1)where exists (select 1 from b,c where b.b2=c.c1 and b.b1=a.a1)
uj5u.com熱心網友回復:
merge into ausing (select * from b,c where b.b2=c.c1)m1
on (a.a1=m1.b1)
when matched then
update set a2=mq1.c2
uj5u.com熱心網友回復:
通過這描述能寫出sql來,就厲害
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/66592.html
標籤:基礎和管理
上一篇:MySQL,優化查詢的方法
