Received: from proxy.bazzanese.com (root@ip230.tol11.interbusiness.it [195.120.106.230]) by hub.org (8.8.8/8.7.5) with ESMTP id JAA11853 for ; Tue, 9 Jun 1998 09:41:44 -0400 (EDT) Received: from localhost (sferac@localhost) by proxy.bazzanese.com (8.8.8/8.8.8/Debian/GNU) with SMTP id OAA02804; Tue, 9 Jun 1998 14:50:51 GMT Date: Tue, 9 Jun 1998 14:50:50 +0000 (UTC) From: "Jose' Soares Da Silva" X-Sender: sferac@proxy.bazzanese.com To: Dim Zegebart cc: pgsql-sql@postgreSQL.org Subject: Re: [SQL] querying array In-Reply-To: <357D2A38.4892C577@post.comstar.ru> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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'