X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 96E9F475C3D for ; Thu, 17 Apr 2003 08:18:31 -0400 (EDT) Received: from rtlocal.trade-india.com (mail-relay.trade-india.com [203.196.129.235]) by postgresql.org (Postfix) with SMTP id 7339F475458 for ; Thu, 17 Apr 2003 08:18:25 -0400 (EDT) Received: (qmail 18370 invoked from network); 17 Apr 2003 12:21:18 -0000 Received: from system67.trade-india-local.com (192.168.0.67) by infocom-236-129-del.trade-india.com with SMTP; 17 Apr 2003 12:21:18 -0000 From: Rajesh Kumar Mallah Organization: Infocom Network Limited To: pgsql-sql@postgresql.org Subject: Re: getting rid of "Adding missing FROM-clause entry...." Date: Thu, 17 Apr 2003 17:48:29 +0530 User-Agent: KMail/1.5 References: <200304171557.47319.mallah@trade-india.com> In-Reply-To: <200304171557.47319.mallah@trade-india.com> Cc: daq MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200304171748.29650.mallah@trade-india.com> X-Spam-Status: No, hits=-33.1 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES,SIGNATURE_SHORT_SPARSE, USER_AGENT autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/262 X-Sequence-Number: 12963 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.