pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PFC <lists@boutiquenumerique.com>
To: Tim <postgres@timkoop.com>
To: pgsql-sql@postgresql.org
Subject: Re: Matching a column against values in code
Date: Wed, 16 Feb 2005 21:01:10 +0100
Message-ID: <opsma278btth1vuj@musicbox> (raw)
In-Reply-To: <420CD984.8010608@timkoop.com>
References: <420CD984.8010608@timkoop.com>


	This has been discussed a few hours ago on the mailing list on the  
subject '[SQL] More efficient OR'


On Fri, 11 Feb 2005 10:12:52 -0600, Tim <postgres@timkoop.com> wrote:

> Hello all.
>
> I sometimes find myself needing an SQL query that will return all the  
> rows of a table in which one column equals any one of a list of values I  
> have in an array in code.
>
> Does anyone know of a better way to do this than to loop through the  
> array and append an "or" comparison to the sql statement, like this?
>
> sqlString = sqlString + " or this_column='" + arrayOfValues[i] +"' ";
>
>
> If someone knows a command or function I can look up in the docs, just  
> say the name and I'll look there. Thanks a lot everyone.
>
> --
> Tim
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org
>





view thread (2+ messages)

Message-ID: <opsma278btth1vuj@musicbox>
Permalink:  ../opsma278btth1vuj@musicbox/
Also on:    postgresql.org/message-id/opsma278btth1vuj@musicbox

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: lists@boutiquenumerique.com, postgres@timkoop.com
  Subject: Re: Matching a column against values in code
  In-Reply-To: <opsma278btth1vuj@musicbox>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox