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

selecting using WHERE on arrays

From: Adam Lowry <aclowry(at)umr(dot)edu>
To: pgsql-novice(at)postgresql(dot)org
Subject: selecting using WHERE on arrays
Date: 2001-02-25 04:30:27
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Hello, I'm getting ramped up on pgsql, and so far the documentation has 
helped wonderfully on everything but this problem.

Is it possible to perfom a select query where that will return any row that 
contains a particular value in an attribute array? That does't sound very 
clear. What I'm trying to do is something like this (to use a music album 

in a table ALBUM we'd have:
name text, etc
artist integer[] - where these integers are foreign keys into the artist 

what I'd like to do is:
select * from album where <artist index X is in artist array>;

Is this possible? All I've been able to do so far is select where a value = a 
particular entry in the array ( [0] for example). Am I thinking about this 
all wrong?

Thanks, Adam

In response to

pgsql-novice by date

Next:From: Mark, TerryDate: 2001-02-26 15:54:52
Subject: RE: copying tables
Previous:From: Rob ArnoldDate: 2001-02-25 03:44:48
Subject: Re: Win32 Client Tools

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