iT邦幫忙

0

postgresql 更新大量資料表

  • 分享至 

  • xImage

我現在有表 well_info 跟 well_test
要更新資料但是他一直抱錯 找不到原因

語法如下
update well_info as we
set we.site_name = up.site_name
from well_test as up
where we.site_no = up.site_no

錯誤如下
ERROR: column "we" of relation "well_info" does not exist
LINE 2: set we.site_name = up.site_name
^
SQL 状态: 42703
字符: 28

powerc iT邦研究生 5 級 ‧ 2022-01-07 15:47:24 檢舉
set site_name = up.site_name,不用加we
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 個回答

1
海綿寶寶
iT邦大神 1 級 ‧ 2022-01-07 16:28:20
最佳解答

https://ithelp.ithome.com.tw/upload/images/20220107/20001787jeFcXTUcGq.png

0
純真的人
iT邦大師 1 級 ‧ 2022-01-07 16:24:58

應該是這樣的吧~

update well_info
set site_name = well_test.site_name
from well_test
where well_info.site_no = well_test.site_no

我要發表回答

立即登入回答