Selecting from arrays

From: Simon Drabble <simond(at)foxlink(dot)net>
To: Postgres Group <pgsql-general(at)postgreSQL(dot)org>
Subject: Selecting from arrays
Date: 1999-05-07 15:36:05
Message-ID: Pine.LNX.3.96.990507112714.12605B-100000@dragon
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Sorry if this has been answered before but a dejanews search turned up
nothing relevant.

I'm trying to select from a table which has a couple of array columns,
and I want to constrain the select on those columns, i.e. something like
(pseudo-code)

select date,loc from results where value appears in temperature

results table:

date loc temperature (int4[])
12/01/98 4th & Main {12, 14, 14, 15, 17, 19, 25, ...}
12/04/98 Station 4 {12, 13, 14, 666, 18, 20, 24, ...}

I want to select only those rows where one of the recorded temps is equal to ,
say, 17 , and also to select a range (rows where temp > 20, or where temp <
10). I might also want to select rows where the temp could not be measured
(indicated by 666) at a certain period.

I can do it if I step through each of the temperature values and compare each
one, but this seems needlessly inefficient.

Is there a quick way to retrieve these rows?

Simon.

--
Caveat lector

Simon Drabble Somewhere in cyberspace
simond(at)foxlink(dot)net

Browse pgsql-general by date

  From Date Subject
Next Message Jonny Hinojosa 1999-05-07 20:19:05 Regression test failures
Previous Message Carlos Peralta Ramirez 1999-05-07 14:56:44 Functions for arrays !!!!