Re: More efficient OR

From: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>
To: KeithW(at)narrowpathinc(dot)com
Cc: PostgreSQL SQL <pgsql-sql(at)postgresql(dot)org>
Subject: Re: More efficient OR
Date: 2005-02-16 16:15:15
Message-ID: 1108570515.11967.223.camel@state.g2switchworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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')

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Sean Davis 2005-02-16 16:21:01 Re: More efficient OR
Previous Message Reinoud van Leeuwen 2005-02-16 16:15:08 Re: More efficient OR