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

Comparing arrays

From: A Gilmore <agilmore(at)shaw(dot)ca>
To: Postgresql Mailing list <pgsql-novice(at)postgresql(dot)org>
Subject: Comparing arrays
Date: 2005-10-03 04:09:45
Message-ID: 4340AF09.8030101@shaw.ca (view raw or flat)
Thread:
Lists: pgsql-novice
Hello,

Id like to compare two arrays, and if any value is found in both, return 
true.  Is this possible without needing a procedure to loop through one?

For example, say categories is an array :

SELECT * FROM t1 WHERE ANY(ARRAY[5,7,9]) = ANY(categories);

Obviously this doesn't work, but you can kinda see what Im trying to do.

Thank you for any insight,
- A Gilmore

Responses

pgsql-novice by date

Next:From: Andreas KretschmerDate: 2005-10-03 06:52:10
Subject: Re: Importing Later Release.....
Previous:From: Tom LaneDate: 2005-10-03 01:18:17
Subject: Re: Vacuum analyse 8.0.3

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