本文介紹了根據(jù)另一個(gè)表結(jié)果更新的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!
問題描述
我想根據(jù)另一個(gè)表結(jié)果集更新臨時(shí)表.
I want to update a temp table based on another table result set.
任何建議.選擇查詢獨(dú)立工作.但我正在考慮與更新語(yǔ)句集成.
Any suggestions. The select query works independently. But I am thinking to integrate with the update statement.
UPDATE #person_membership_promo_ext
SET note_about=
(
select note_text
FROM note nt
INNER JOIN #person_membership_promo_ext per
ON per.person_id=nt.main_ref_id
and per.membership_type='P'
and note_id=(select MAX(note_id)from note nt_1
where nt_1.main_ref_id=per.person_id)
)
推薦答案
給你,
Update per
set per.note_about = nt.note_text
FROM note nt
INNER JOIN #person_membership_promo_ext per
ON per.person_id=nt.main_ref_id
and per.membership_type='P'
and note_id=(select MAX(note_id)from note nt_1
where nt_1.main_ref_id=per.person_id)
我希望這會(huì)有所幫助!
這篇關(guān)于根據(jù)另一個(gè)表結(jié)果更新的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!