Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id B7C7963232C for ; Fri, 8 Jan 2010 12:06:57 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 49339-10 for ; Fri, 8 Jan 2010 16:06:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.157]) by mail.postgresql.org (Postfix) with ESMTP id A0D476338B3 for ; Fri, 8 Jan 2010 12:06:46 -0400 (AST) Received: by fg-out-1718.google.com with SMTP id 22so7783612fge.1 for ; Fri, 08 Jan 2010 08:06:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=ScXcbYD9YgQMguO/oABvAkaygeUhQdRdB8ItS2LSOPk=; b=u1qBGh9Tvup6qh5obr7Oe57RdssH/uj+tb2/V5RQ9KDpwCLmdLN6dcEeOd8PjV0FWI 5Q0cyMePw/VjAN23ZXRHPrHsg8uBwIKaseIqD2hs6jC8X1WKx0eM/x4XDA/wSQ9h8Ko5 uMmGAepIjnYXFWmZOdeSKzXrBCU+dxCgn+MAI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=uLIGw9xwaTEifIqXI9PymEGFSZX6n+wj1ro6GwdcMD+WDyxJSL7QBlaFHD8sxw1mEf dJrr2QXMrFAKDNrb5cqyL6XuUvCV4v/EG1HSuq/kVnNXzMfEsx0aGUAeH8cIbgm4z54G rtrTiXLm9BGYKKfwDgTshGQNBHsD9Z+D/34+Y= MIME-Version: 1.0 Received: by 10.239.189.12 with SMTP id r12mr751014hbh.94.1262966804904; Fri, 08 Jan 2010 08:06:44 -0800 (PST) In-Reply-To: <10E4D065260941509531A32BDC0AB647@ramasubramanian> References: <10E4D065260941509531A32BDC0AB647@ramasubramanian> Date: Fri, 8 Jan 2010 16:06:44 +0000 Message-ID: <4cb7e1b21001080806o443d6e2bxbccc2f6b820395d3@mail.gmail.com> Subject: Re: Array comparison From: Rui Carvalho To: ramasubramanian Cc: pgsql-performance@postgresql.org Content-Type: multipart/alternative; boundary=001485f63082c4fbb9047ca95fd0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.598 tagged_above=-10 required=5 tests=BAYES_00=-2.599, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201001/143 X-Sequence-Number: 37023 --001485f63082c4fbb9047ca95fd0 Content-Type: text/plain; charset=ISO-8859-1 Hi well it's pretty simple if you want to see if there are elements in common then instead of "any" use "&&" if you want to see if they are equal just use " = " that will five you true or false you can check array functions in here http://www.postgresql.org/docs/8.2/static/functions-array.html On Fri, Jan 8, 2010 at 5:00 AM, ramasubramanian < ramasubramanian.g@renaissance-it.com> wrote: > Hi all, > I want to compare the two arrys in sql, The below example is wrong. > But i want to know how to do that in postgres 8.2.5 > > SELECT 'x' WHERE string_to_array('the,quick,ram,fox', ',') any > (string_to_array('the,quick,lazy ,fox', ',')) > Regards, > Ram > > > > --001485f63082c4fbb9047ca95fd0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi

well it's pretty simple

if you want to see if there ar= e elements in common then instead of "any" use "&&&q= uot;
if you want to see if they are equal just use " =3D " tha= t will five you true or false



=A0you can check array functions in here http://www.postgresql.= org/docs/8.2/static/functions-array.html


On Fri, Jan 8, 2010 at 5:00 AM, ramasubramanian <ramasubramanian.g@renais= sance-it.com> wrote:
Hi all,
I want to compare the two arrys in sql= , The below=20 example is wrong.
But i want to know how to do that in p= ostgres=20 8.2.5
=A0
SELECT 'x'=A0=A0 WHERE=A0=20 string_to_array('the,quick,ram,fox', ',')=A0 any=20 (string_to_array('the,quick,lazy ,fox', ','))
Regards,
Ram
=A0

--001485f63082c4fbb9047ca95fd0--