X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1B9974758E6 for ; Wed, 9 Apr 2003 03:18:07 -0400 (EDT) Received: from rtlocal.trade-india.com (mail-relay.trade-india.com [203.196.129.235]) by postgresql.org (Postfix) with SMTP id 595A3474E42 for ; Wed, 9 Apr 2003 03:18:02 -0400 (EDT) Received: (qmail 1163 invoked from network); 9 Apr 2003 07:19:57 -0000 Received: from system67.trade-india-local.com (192.168.0.67) by infocom-236-129-del.trade-india.com with SMTP; 9 Apr 2003 07:19:57 -0000 From: Rajesh Kumar Mallah Organization: Infocom Network Limited To: pgsql-sql@postgresql.org Subject: question about visibilty while updating multiple rows . Date: Wed, 9 Apr 2003 12:47:59 +0530 User-Agent: KMail/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200304091247.59378.mallah@trade-india.com> X-Spam-Status: No, hits=-6.4 required=5.0 tests=BAYES_10,SIGNATURE_SHORT_SPARSE,USER_AGENT version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/127 X-Sequence-Number: 12828 Hi, If an update statement is affecting multiple rows of a table X , Does a subselect (selecting from X only) inside EXISTS part of outer query able to see the changes when rows are being updated one by one by outer query? for example consider following set of data rows: +------------+-----------------------+------+----------+----------------------------------+ | profile_id | co_name | size | deletion | md5 | +------------+-----------------------+------+----------+----------------------------------+ | 212161 | ATITH FIBRE PVT. LTD. | FL | t | edc462794427724b7d132e3b1387d69f | | 212159 | ATITH FIBRE PVT. LTD. | 1HS | f | edc462794427724b7d132e3b1387d69f | | 216225 | ATITH FIBRE PVT. LTD. | 1HS | f | edc462794427724b7d132e3b1387d69f | | 216226 | ATITH FIBRE PVT. LTD. | 1HS | f | edc462794427724b7d132e3b1387d69f | +------------+-----------------------+------+----------+----------------------------------+ begin work; UPDATE eyp_profiles_table SET deletion=true WHERE co_name='ATITH FIBRE PVT. LTD.' AND deletion is false and EXISTS (select * from eyp_profiles_table a where a.md5=eyp_profiles_table.md5 and a.deletion is false and a.profile_id <> eyp_profiles_table.profile_id) ; my original problem is to update in such a way that i get below finally (observer the deletion column) +------------+-----------------------+------+----------+----------------------------------+ | profile_id | co_name | size | deletion | md5 | +------------+-----------------------+------+----------+----------------------------------+ | 212161 | ATITH FIBRE PVT. LTD. | FL | t | edc462794427724b7d132e3b1387d69f | | 212159 | ATITH FIBRE PVT. LTD. | 1HS | t | edc462794427724b7d132e3b1387d69f | | 216225 | ATITH FIBRE PVT. LTD. | 1HS | t | edc462794427724b7d132e3b1387d69f | | 216226 | ATITH FIBRE PVT. LTD. | 1HS | f | edc462794427724b7d132e3b1387d69f | +------------+-----------------------+------+----------+----------------------------------+ so that only one entry per md5 record exists. 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.