pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rod Taylor <pg@rbt.ca>
To: Marco Lazzeri <marcomail@noze.it>
Cc: pgsql-sql@postgresql.org
Subject: Re: Check a value in array
Date: Thu, 29 Apr 2004 13:56:47 -0400
Message-ID: <1083261407.30065.303.camel@jester> (raw)
In-Reply-To: <1083260230.20352.7.camel@macbeth.intranet.noze.it>
References: <1083260230.20352.7.camel@macbeth.intranet.noze.it>

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.





view thread (5+ messages)  latest in thread

Message-ID: <1083261407.30065.303.camel@jester>
Permalink:  ../1083261407.30065.303.camel@jester/
Also on:    postgresql.org/message-id/1083261407.30065.303.camel@jester

 · 

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: pg@rbt.ca, marcomail@noze.it
  Subject: Re: Check a value in array
  In-Reply-To: <1083261407.30065.303.camel@jester>

* 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