将join-query从数据库复制到另一个datable

时间:2016-11-18 08:04:19

标签: postgresql inner-join dblink

以前,我使用dblink来完成任务,但它只涉及复制一个查询。如果我在一个数据库中进行连接查询(4个表),然后我想将数据输出复制到另一个数据库,该怎么办?有人知道吗?

select 
    a.sysname, a.ip, b.host_id, b.resource_name, b.resource_id
    , c.metric_id, d.metric_name,  c.value, c.resource_id
    , to_timestamp(c.date_id)as datetime 
from inv.el a 
inner join inv.if b on a.host_id = b.host_id 
inner join me.me_cr c on b.resource_id = c.resource_id 
inner join inv.me d on c.metric_id = d.metric_id 
where date_id = (
    select max(date_id) from me.me_cr
)

1 个答案:

答案 0 :(得分:0)

您可以尝试在发布>上使用top: 6px 9.6因为它

  

...现在支持远程连接...

https://www.postgresql.org/docs/9.6/static/release-9-6.html

相关问题