pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedpostgres 9.1 - querie problem using a dblink
3+ messages / 2 participants
[nested] [flat]
* postgres 9.1 - querie problem using a dblink
@ 2014-12-17 10:08 Khangelani Gama <kgama@argility.com>
2014-12-17 11:11 ` Re: postgres 9.1 - querie problem using a dblink Khangelani Gama <kgama@argility.com>
0 siblings, 1 reply; 3+ messages in thread
From: Khangelani Gama @ 2014-12-17 10:08 UTC (permalink / raw)
To: pgsql-admin
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.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: postgres 9.1 - querie problem using a dblink
2014-12-17 10:08 postgres 9.1 - querie problem using a dblink Khangelani Gama <kgama@argility.com>
@ 2014-12-17 11:11 ` Khangelani Gama <kgama@argility.com>
2014-12-17 15:25 ` Re: postgres 9.1 - querie problem using a dblink Scott Ribe <scott_ribe@elevated-dev.com>
0 siblings, 1 reply; 3+ messages in thread
From: Khangelani Gama @ 2014-12-17 11:11 UTC (permalink / raw)
To: 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.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: postgres 9.1 - querie problem using a dblink
2014-12-17 10:08 postgres 9.1 - querie problem using a dblink Khangelani Gama <kgama@argility.com>
2014-12-17 11:11 ` Re: postgres 9.1 - querie problem using a dblink Khangelani Gama <kgama@argility.com>
@ 2014-12-17 15:25 ` Scott Ribe <scott_ribe@elevated-dev.com>
0 siblings, 0 replies; 3+ messages in thread
From: Scott Ribe @ 2014-12-17 15:25 UTC (permalink / raw)
To: Khangelani Gama <kgama@argility.com>; +Cc: pgsql-admin
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 exist in 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 message says ;-)
--
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2014-12-17 15:25 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-12-17 10:08 postgres 9.1 - querie problem using a dblink Khangelani Gama <kgama@argility.com>
2014-12-17 11:11 ` Khangelani Gama <kgama@argility.com>
2014-12-17 15:25 ` Scott Ribe <scott_ribe@elevated-dev.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox