Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 4681F9FB4F7 for ; Fri, 13 Oct 2006 18:25:45 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 58590-03 for ; Fri, 13 Oct 2006 21:25:38 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.177]) by postgresql.org (Postfix) with ESMTP id 1B77A9FB4F2 for ; Fri, 13 Oct 2006 18:25:37 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id d80so1308362pyd for ; Fri, 13 Oct 2006 14:25:36 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=oxLOYDDh7Gb2Dp+lxNdz4chPji3atvkQwIRrHnxIEUNOU9ljQ2RhtSvnw/yK0hBxNZWytWx07xpPO6GgeoOkWwYvxdidwGcFryTiRqIeNyk2MDaMw5EDCmWcnmt/aU/OfHE4JpFmBrwEwdITDwjsmPlnLxxnCvCImx1nXoV97Xk= Received: by 10.35.60.15 with SMTP id n15mr6514892pyk; Fri, 13 Oct 2006 14:25:36 -0700 (PDT) Received: by 10.35.80.9 with HTTP; Fri, 13 Oct 2006 14:25:36 -0700 (PDT) Message-ID: Date: Fri, 13 Oct 2006 16:25:36 -0500 From: "Aaron Bono" To: "Alexander Burbello" Subject: Re: Recursive use Cc: "Lista Postgres" In-Reply-To: <4523B23A.3000506@yahoo.com.br> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_34117_12895471.1160774736695" References: <4523B23A.3000506@yahoo.com.br> X-Google-Sender-Auth: a3b59f9aa3fff325 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.696 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, HTML_40_50, HTML_MESSAGE, SPF_PASS X-Spam-Level: X-Archive-Number: 200610/95 X-Sequence-Number: 23398 ------=_Part_34117_12895471.1160774736695 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 10/4/06, Alexander Burbello wrote: > > Hi people, > > I need to know if Postgres do recursive search and how can I do! > I will explain my problem. > > > table COOPERATIVE > code_cooperative int > code_coo_father int > > I can have 3 level by business rules > > 1 - Father > ----- 2 - Children > --------- 3 - Grandchildren > > > I would like to have a query asking who is father and granfather > select grandfather, father from COOPERATIVE where COD_COOPERATIVE = 3 > > Do the Postgres can solve this problem? > Could anybody help me? I see this question every few months. Check out this post: http://archives.postgresql.org/pgsql-sql/2001-11/msg00438.php -- ================================================================== Aaron Bono Aranya Software Technologies, Inc. http://www.aranya.com http://codeelixir.com ================================================================== ------=_Part_34117_12895471.1160774736695 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 10/4/06, Alexander Burbello <burbello3000@yahoo.com.br> wrote:
Hi people,

I need to know if Postgres do recursive search and how can I do!
I will explain my problem.


table COOPERATIVE
  code_cooperative int
  code_coo_father int

I can have 3 level by business rules

1 - Father
----- 2 - Children
--------- 3 - Grandchildren


I would like to have a query asking who is father and granfather
select grandfather, father from COOPERATIVE where COD_COOPERATIVE = 3

Do the Postgres can solve this problem?
Could anybody help me?

I see this question every few months.

Check out this post: http://archives.postgresql.org/pgsql-sql/2001-11/msg00438.php

--
==================================================================
   Aaron Bono
   Aranya Software Technologies, Inc.
   http://www.aranya.com
   http://codeelixir.com
================================================================== ------=_Part_34117_12895471.1160774736695--