[英]How to update the each record in sql server
我需要使用更新腳本更新表中的每個記錄
查詢1:
Select acheivementsId
from Students
where student_id = 2
結果:: 61條記錄//成就數量
查詢2:
Select acheivementsId
from Students
where student_id = 4
結果:61條記錄//成就數量
我需要使用student_id = 4 acheivementId更新Student_id = 2 acheivementid。
如何編寫用於更新61條記錄的更新語句。
謝謝
嘗試這個:
UPDATE Students
SET acheivementsId = (SELECT acheivementsId from Students where Student_id=4)
WHERE Student_id=2
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.