Обсуждение: postgres 9.1 - querie problem using a dblink

Поиск
Список
Период
Сортировка

postgres 9.1 - querie problem using a dblink

От
Khangelani Gama
Дата:

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.

Re: postgres 9.1 - querie problem using a dblink

От
Khangelani Gama
Дата:

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.

Re: postgres 9.1 - querie problem using a dblink

От
Scott Ribe
Дата:
On Dec 17, 2014, at 4:11 AM, Khangelani Gama <kgama@argility.com> wrote:
>
> Please help, when I run this querie I get an error saying : column "cdbs_br_cde" specified in USING clause does not
existin left table 

Well, does column cdbs_br_cde exist in eis_mtd_sales@cen_8008? My guess is it does not, since that's what the error
messagesays ;-) 

--
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice