Skip site navigation (1) Skip section navigation (2)

Re: Check a value in array

From: Rod Taylor <pg(at)rbt(dot)ca>
To: Marco Lazzeri <marcomail(at)noze(dot)it>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Check a value in array
Date: 2004-04-29 17:56:47
Message-ID: 1083261407.30065.303.camel@jester (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
On Thu, 2004-04-29 at 13:37, Marco Lazzeri wrote:
> Hi all.
> I have to check if a value is in an array.
> I've got a date array in a table and I would like to perform queries
> like:
> SELECT * FROM table WHERE date IN dates_array;

If you're using 7.4 or later, try:

	SELECT * FROM table WHERE date = ANY(dates_array);

This will work without the contrib package.

In response to


pgsql-sql by date

Next:From: Josh BerkusDate: 2004-04-29 19:20:01
Subject: Re: Equivalant of SQL Server's Nchar and NVARCHAR
Previous:From: Marco LazzeriDate: 2004-04-29 17:37:11
Subject: Check a value in array

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group