pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedquerying array
2+ messages / 2 participants
[nested] [flat]
* querying array
@ 1998-06-09 12:27 Dim Zegebart <zager@post.comstar.ru>
1998-06-09 14:50 ` Re: [SQL] querying array Jose' Soares Da Silva <sferac@bo.nettuno.it>
0 siblings, 1 reply; 2+ messages in thread
From: Dim Zegebart @ 1998-06-09 12:27 UTC (permalink / raw)
To: pgsql-sql
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 ?
Thank in advance.
--
____ ____
| \ / Dim Zegebart
____/____
Moscow Russia
WWW - http://www.geocities.com/siliconvalley/pines/7817
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [SQL] querying array
1998-06-09 12:27 querying array Dim Zegebart <zager@post.comstar.ru>
@ 1998-06-09 14:50 ` Jose' Soares Da Silva <sferac@bo.nettuno.it>
0 siblings, 0 replies; 2+ messages in thread
From: Jose' Soares Da Silva @ 1998-06-09 14:50 UTC (permalink / raw)
To: Dim Zegebart <zager@post.comstar.ru>; +Cc: 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'
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~1998-06-09 14:50 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-06-09 12:27 querying array Dim Zegebart <zager@post.comstar.ru>
1998-06-09 14:50 ` Jose' Soares Da Silva <sferac@bo.nettuno.it>
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