Re: postgres 9.1 - querie problem using a dblink

Поиск
Список
Период
Сортировка
От Khangelani Gama
Тема Re: postgres 9.1 - querie problem using a dblink
Дата
Msg-id a445ee53dbb3a7135375d035b681457d@mail.gmail.com
обсуждение исходный текст
Ответ на postgres 9.1 - querie problem using a dblink  (Khangelani Gama <kgama@argility.com>)
Ответы Re: postgres 9.1 - querie problem using a dblink
Список pgsql-admin

Sorry, I came with this …the db cent_8008 doesn’t  have two columns cdbs_br_cde,cdbs_grp_cde

 

From: Khangelani Gama [mailto:kgama@argility.com]
Sent: 17 December 2014 12:08 PM
To: pgsql-admin@postgresql.org
Subject: postgres 9.1 - querie problem using a dblink

 

Hi

 

Please help, when I run this querie I get an error saying : column "cdbs_br_cde" specified in USING clause does not exist in left table

 

The DATABASE LINK is called cen_8008.

 

 

select a.cdbs_br_cde as br_cde,

sum(case when b.value_type=107 then a.value else 0 end) as mtd_sog,

sum(case when b.value_type=110 then a.value else 0 end) as mtd_cos

from eis_mtd_sales@cen_8008 a

left join eis_value_types@cen_8008 b using (cdbs_br_cde,cdbs_grp_cde,value_type)

--left join eis_daily_sales@cen_8008 c on  (b.cdbs_br_cde=c.cdbs_br_cde and b.cdbs_grp_cde=c.cdbs_grp_cde and b.value_type=c.value_type and c.value_date::date=sysdate::date -interval '1 day')

where 1=1

--and a.cdbs_br_cde='8008'

and a.cdbs_grp_cde='1~7~1'

and a.fpp_cde='201412'

and a.value_type in (107,110)

group by a.cdbs_br_cde

order by a.cdbs_br_cde;

 

 

 

 

 

example on how I created the dblink for cent8008

 

CREATE public DATABASE LINK cen_8008 CONNECT TO user IDENTIFIED BY 'passwd' USING libpq 'host=IP port=3456 dbname=c8008';

 

 

 

 

 

 

 

 


CONFIDENTIALITY NOTICE
The contents of and attachments to this e-mail are intended for the addressee only, and may contain the confidential
information of Argility (Proprietary) Limited and/or its subsidiaries. Any review, use or dissemination thereof by anyone
other than the intended addressee is prohibited.If you are not the intended addressee please notify the writer immediately
and destroy the e-mail. Argility (Proprietary) Limited and its subsidiaries distance themselves from and accept no liability
for unauthorised use of their e-mail facilities or e-mails sent other than strictly for business purposes.

В списке pgsql-admin по дате отправления:

Предыдущее
От: Khangelani Gama
Дата:
Сообщение: postgres 9.1 - querie problem using a dblink
Следующее
От: Scott Ribe
Дата:
Сообщение: Re: postgres 9.1 - querie problem using a dblink