pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Khangelani Gama <kgama@argility.com>
To: pgsql-admin@postgresql.org
Subject: Re: postgres 9.1 - querie problem using a dblink
Date: Wed, 17 Dec 2014 13:11:35 +0200
Message-ID: <a445ee53dbb3a7135375d035b681457d@mail.gmail.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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.


view thread (3+ messages)  latest in thread

Message-ID: <a445ee53dbb3a7135375d035b681457d@mail.gmail.com>
Permalink:  ../a445ee53dbb3a7135375d035b681457d@mail.gmail.com/
Also on:    postgresql.org/message-id/a445ee53dbb3a7135375d035b681457d@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: kgama@argility.com
  Subject: Re: postgres 9.1 - querie problem using a dblink
  In-Reply-To: <a445ee53dbb3a7135375d035b681457d@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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