From: | "Jose' Soares Da Silva" <sferac(at)bo(dot)nettuno(dot)it> |
---|---|
To: | Dim Zegebart <zager(at)post(dot)comstar(dot)ru> |
Cc: | pgsql-sql(at)postgreSQL(dot)org |
Subject: | Re: [SQL] querying array |
Date: | 1998-06-09 14:50:50 |
Message-ID: | Pine.LNX.3.96.980609145010.2779A-100000@proxy.bazzanese.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Tue, 9 Jun 1998, Dim Zegebart wrote:
> Hi,
> is there any way to do selection from table by testing array attribute
> for
> presence of defined value ?
> SQL speaking :
> create tabel foo(n int2[]);
> insert into foo (n) values('{1,2,3}');
> insert into foo (n) values('{4,7,8,5}');
> insert into foo (n) values('{4,5}');
> //now I want to select only exeplars with n containing '5'. It should be
> second and third records :
> select * from foo where foo.n?????
> //That I shoud type next ?
>
select * from foo where foo.n[1]=5 or foo.n[2]=5 or foo.n[4]=5;
n
---------
{4,7,8,5}
{4,5}
(2 rows)
Jose'
From | Date | Subject | |
---|---|---|---|
Next Message | Jose' Soares Da Silva | 1998-06-09 16:09:09 | Re: [SQL] text concat in WHERE? |
Previous Message | Herouth Maoz | 1998-06-09 12:55:46 | Re: [SQL] questions |