![](/img/trans.png)
[英]Insert data from column to another different table column with modifying in PSQL
[英]insert into a jsonb column selecting from different table in psql
插入jsonb列,從psql的不同表中選擇。 我想要像jsonb插入
{"name": "myname" ,"email": "test@gmail.com"}
我想做類似“ name”的事情:“ myname”常量值,並且從另一個表中選擇了電子郵件
insert into test1 (column1) select {"name": "myname" ,"email": email}
只需使用row_to_json將選定的行轉換為json。 然后在必要時將其轉換為jsob。
insert into test1 (column1)
select row_to_json(x)::jsonb from (select 'myname' as name, email from another_table) x;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.