X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E73BE8BA27F for ; Wed, 16 Feb 2005 16:15:22 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75359-01 for ; Wed, 16 Feb 2005 16:15:17 +0000 (GMT) Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by svr1.postgresql.org (Postfix) with ESMTP id 364C78B9B5B for ; Wed, 16 Feb 2005 16:15:16 +0000 (GMT) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 16 Feb 2005 10:15:15 -0600 Subject: Re: More efficient OR From: Scott Marlowe To: KeithW@narrowpathinc.com Cc: PostgreSQL SQL In-Reply-To: <20050216155901.M41773@narrowpathinc.com> References: <20050216155901.M41773@narrowpathinc.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1108570515.11967.223.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Wed, 16 Feb 2005 10:15:15 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/162 X-Sequence-Number: 20273 On Wed, 2005-02-16 at 10:02, Keith Worthington wrote: > Hi All, > > In several of my SQL statements I have to use a WHERE clause that contains > mutiple ORs. i.e. > > WHERE column1 = 'A' OR > column1 = 'B' OR > column1 = 'C' > > Is there a more efficient SQL statement that accomplishes the same limiting > functionality? The in() construct is (nowadays) basically the same as ORing multiple columns; where column1 in ('A','B','C')