pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rajesh Kumar Mallah <mallah@trade-india.com>
To: pgsql-sql@postgresql.org
Cc: daq <daq@ugyvitelszolgaltato.hu>
Subject: Re: getting rid of "Adding missing FROM-clause entry...."
Date: Thu, 17 Apr 2003 17:48:29 +0530
Message-ID: <200304171748.29650.mallah@trade-india.com> (raw)
In-Reply-To: <200304171557.47319.mallah@trade-india.com>
References: <200304171557.47319.mallah@trade-india.com>




Actually i have to update multiple columns my original 
query was:

UPDATE  profile_master    SET

 title1=a.title1 , fname1=a.fname1 , mname1=a.mname1 ,
 lname1=a.lname1 , desg1 = a.desg1 FROM 

(
   SELECT company_id , titile as title1 ,fname as fname1 ,mname as mname1 ,
   lname as lname1 ,company_position as desg1  from public.catalog_key_contacts as b 
   where  b.company_id=profile_master.company_id order by contact_id limit 1 offset 0)  

as a WHERE 

profile_master.source='CATALOG' ;

Regds
Mallah.



On Thursday 17 Apr 2003 3:57 pm, Rajesh Kumar Mallah wrote:
> Hi I am having problem with an UPDATE ... FROM
> SQL where the FROM table is a subquery.
>
> UPDATE  profile_master set title1=a.title1  FROM
> (
>
> SELECT company_id , titile as title1 ,fname as fname1 ,mname as mname1
> ,lname as lname1 ,company_position as desg1  from
> public.catalog_key_contacts  where company_id=profile_master.company_id
> order by contact_id limit 1 offset 0 )  as a
> where profile_master.source='CATALOG' ;
> NOTICE:  Adding missing FROM-clause entry in subquery for table
> "profile_master" UPDATE 711
>
> its showing an update of 711 however all the 711 matching rows are getting
> updated to the same value.
>
> can anyone tell me how to write this query properly ?
>
> Regds
> Mallah.

-- 
Rajesh Kumar Mallah,
Project Manager (Development)
Infocom Network Limited, New Delhi
phone: +91(11)6152172 (221) (L) ,9811255597 (M)

Visit http://www.trade-india.com ,
India's Leading B2B eMarketplace.




view thread (10+ messages)  latest in thread

Message-ID: <200304171748.29650.mallah@trade-india.com>
Permalink:  ../200304171748.29650.mallah@trade-india.com/
Also on:    postgresql.org/message-id/200304171748.29650.mallah@trade-india.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-sql@postgresql.org
  Cc: mallah@trade-india.com, daq@ugyvitelszolgaltato.hu
  Subject: Re: getting rid of "Adding missing FROM-clause entry...."
  In-Reply-To: <200304171748.29650.mallah@trade-india.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