[英]SQL query to get value from the table for a record and update the fetched value for different record in the same table
[英]SQL Query — update many records from 1 record in same table
我們有一張桌子。 同一位置可能在我們的表中多次出現(錯誤的設計,不是我們的選擇)。 我們找人經過,找到了每個地方的地址。 他們僅更新了每個地方的許多實例之一。
這是一個行不通的查詢,但我認為顯示了我要執行的操作。
update places set address1 = places2.address1
inner join places places2 ON places.placename = places2.placename
where (places2.address1 <> '' AND places2.address1 is not null)
有人想給我一個正確的方向嗎?
update places set address1 = places2.address1
from places inner join places places2 ON places.placename = places2.placename
where (places2.address1 <> '' AND places2.address1 is not null)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.