Matching a column against values in code - Mailing list pgsql-sql

From Tim
Subject Matching a column against values in code
Date
Msg-id 420CD984.8010608@timkoop.com
Whole thread Raw
Responses Re: Matching a column against values in code  (PFC <lists@boutiquenumerique.com>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: "Ray Madigan"
Date:
Subject: Count Columns
Next
From: "Simon Kinsella"
Date:
Subject: GROUPing only those rows that do not contain a NULL field?