Re: Matching a column against values in code

From: PFC <lists(at)boutiquenumerique(dot)com>
To: Tim <postgres(at)timkoop(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Matching a column against values in code
Date: 2005-02-16 20:01:10
Message-ID: opsma278btth1vuj@musicbox
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


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(at)timkoop(dot)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
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message T- Bone 2005-02-16 20:16:36 Comments on subquery performance
Previous Message Bruno Wolff III 2005-02-16 19:58:22 Re: Count Columns