X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 03740D1B8E0 for ; Mon, 25 Aug 2003 02:59:47 -0300 (ADT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 93741-06 for ; Mon, 25 Aug 2003 02:59:37 -0300 (ADT) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by svr1.postgresql.org (Postfix) with ESMTP id E0AFAD1B8C6 for ; Mon, 25 Aug 2003 02:59:34 -0300 (ADT) Received: from klaster.net (core-1.citynet.pl [80.48.135.69]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id DFCB22B3A4; Mon, 25 Aug 2003 07:59:33 +0200 (CEST) Message-ID: <3F49A5DF.1040405@klaster.net> Date: Mon, 25 Aug 2003 07:59:59 +0200 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; pl-PL; rv:1.5a) Gecko/20030718 X-Accept-Language: pl, en-us, en MIME-Version: 1.0 To: Rajesh Kumar Mallah Cc: pgsql-sql@postgresql.org Subject: Re: Joined deletes but one table being a subquery. References: <200308221531.13782.mallah@trade-india.com> <3F45EF2E.7060709@klaster.net> <200308231500.37736.mallah@trade-india.com> In-Reply-To: <200308231500.37736.mallah@trade-india.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/292 X-Sequence-Number: 14908 > I apologize for the silence. > > t_a as been created as > > CREATE TABLE t_a as SELECT userid,category_id from eyp_listing where userid=21742 and size ilike '%WEBFL%' > EXCEPT SELECT userid,category_id from company_export_profile where userid=21742 ; > > so the subquery is basically > > ( SELECT userid,category_id from eyp_listing where userid=21742 and > size ilike '%WEBFL%' EXCEPT SELECT userid,category_id from company_export_profile > where userid=21742 ) > > > regds > mallah. What about this? delete from eyp_listing where exists (select * from eyp_listing el left join company_export ce using (userid,category_id) where el.userid=21742 and size ilike '%WEBFL%' and ce.userid is null and el.userid=eyp_listing.userid and el.category_id=eyp_listing.category_id); It should be solution, but not the answer for your question... How did you use that sub-select, so it didn't work? Regards, Tomasz Myrta