[英]How to insert data from another table with keys?
我在 Postgresql 中做了这个 SELECT,以测试我在我的项目中需要哪些列,我也卡住了,需要帮助。
SELECT
trb.id,
id_cliente,
id_usuario,
usu.nome_acesso,
id_contribuinte,
to_char(data_mensagem, 'MM/DD/YYYY')
,
assunto,
mensagem
FROM
el_trb_mensagem.trb_mensagem trb
left join el_acesso.gg_usuario usu on (usu.id = trb.id_usuario)
下一步是进行插入,但是对于 postgres 网站文档的基本语法,我不明白,但我认为它比看起来更简单。
insert into <destination table> (<destination columns' names>)
<your select>
例如
insert into table (id,name) select another_id, another_name from another_table
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.