0
我需要更改我的數據庫中的表。我想要的是加入類型爲integer[]
的列,並直接從另一個查詢結果爲4個id號碼的列中添加值。Postgresql alter table - >添加列+值
我目前有:以下錯誤
ALTER TABLE resourcen add rs_insurance integer[]
update resourcen set rs_insurance = (select li_id from li_versicherungsart)
第二個命令返回:
ERROR: column "rs_insurance" is of type integer[] but expression is of type integer
SQL state: 42804
Hint: You will need to rewrite or cast the expression.
Character: 37
如何我投中的所有ID,以適應轉換成int []數組?
'選擇ARRAY_AGG(li_id)...'但你最肯定需要某種合作相關子查詢。但是,如果沒有關於這兩張桌子的更詳細的信息以及它們如何相互關聯,很難說清楚。 –
工作正常!張貼它作爲答案,所以我可以接受它! – Jacob
是的,這是我想要的。但是li_versicherungsart在不同的安裝上有所不同。 – Jacob