Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qoOCG-0015pI-JD for pgsql-novice@arkaria.postgresql.org; Thu, 05 Oct 2023 13:15:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qoOCE-00DKkY-JX for pgsql-novice@arkaria.postgresql.org; Thu, 05 Oct 2023 13:15:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qoOCE-00DKjG-6l for pgsql-novice@lists.postgresql.org; Thu, 05 Oct 2023 13:15:19 +0000 Received: from sonic310-20.consmr.mail.gq1.yahoo.com ([98.137.69.146]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qoOC7-0009T2-RY for pgsql-novice@lists.postgresql.org; Thu, 05 Oct 2023 13:15:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1696511709; bh=b3SrjBsp/7RwdjhnFj6TbGNPjOtSW/mZmhX+5u1mpPY=; h=Date:From:To:In-Reply-To:References:Subject:From:Subject:Reply-To; b=VJMWftj4Vz7HeipnwHrQecGHtw/4TS+mXM1c6ROEuJgtUSFqk2Hhd0YwCDPj7ChSkRONX/N8XKGzcwjpF2Mc1Bco7uDONOKNYkjbTu18DGRJYNsPCTPfYsyGfjLNzEgt0MFgAsreTCX+pmT1p1pce3c+NX+RdAHiYwCNoc9JZfstSLP4TACh0q7mO0hmdwarzokLh5M8bDSbksm8HX492NvCmGcCCvOk/pccbsXk5nbCMGniKxQnPCeE2bKnhyt0Ovn5+GsdVf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elP8Rz1pNVfV5ZtKInsZo_ifsWa cmSOec4dSw0G.D_yay9afS7DbhZIh6KjgiMR_jVFO7h3TH9UOkT7fO4UAE4TzzsP4XGFK4y.j1aU UxlE.IHEEDo93adE1kp.BUi6QN1WjlKGE3etP.9ldJK5.mVMEHobbeQIZBM49b6MIXgeylGrudpx IOjGfVg8FaJuB94I6XCOpzeacftgvcsuJSoEtN0WxnzkTrOCDHZqQoPq8gyE7PnBMBsLJG91XWHN p5e5NpgjfZQNkjY6xHkMmkt.hiIql9rsffiVgIl4P0HTVR5V5srGsVqv3YkYE1GnMgJXQFGfRU9I 4yUjp8tlx.MW.M2yk62ngiL0fN2AxwrI_mU5VCvQBceLsO9p8eQl_u6SP54JRTIygkBeIIISdlkY mpmas4BisuY_zfVPVFZQSS1aZyoZwBv5tTPlBGNdwWS04Lov2Ag5RZEDoFXbuwUBx6pvzRFDtozq nM2Q9KaCrqt7xbkqE9n8THnH69IwurX.GlT4EufbkCY9tE053c9CpSX42NPqQBcXBNUH5OR2OjpR YPX9Z8csl6I_L5m2qrtkc1qGC32MFariLGmi8OudYRL2h6GrOFKfDpYplJyYs7wywADop9ge_zzC llyHITRw4MYIskno7NaFL1WXDhiFjvqODRLMVNT5nR6qvUcjbpmTjJFXyTf4_NYRWHEk1N3dov5I I4pdTbeH0C5OTw5plusUlzAub.3mJ1lrk6MR6nd5e7_yUz6RTSePj4m.u_fa.w2Rq X-Sonic-MF: X-Sonic-ID: 1ee3beef-d219-452a-98c9-ffbcec076922 Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.gq1.yahoo.com with HTTP; Thu, 5 Oct 2023 13:15:09 +0000 Date: Thu, 5 Oct 2023 13:15:07 +0000 (UTC) From: swastik Gurung To: "pgsql-novice@lists.postgresql.org" , Ibrahim Shaame Message-ID: <1901532185.8873313.1696511707263@mail.yahoo.com> In-Reply-To: References: Subject: Re: Reporting by family tree MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_8873312_1844400231.1696511707261" X-Mailer: WebService/1.1.21797 YMailNorrin Content-Length: 9918 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------=_Part_8873312_1844400231.1696511707261 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I suppose you ought to be using, recursive CTE queries Documentation can be found at:=C2=A07.8. WITH Queries (Common Table Express= ions) |=20 |=20 |=20 | | | | | |=20 | |=20 7.8. WITH Queries (Common Table Expressions) 7.8. WITH Queries (Common Table Expressions) # 7.8.1. SELECT in WITH 7.8.2.= Recursive Queries 7.8.3. Common Tabl... | | | On Thursday, 5 October 2023 at 16:44:46 GMT+5:45, Ibrahim Shaame wrote: =20 =20 =20 I have a table of members of alarge family extendending back to eight gener= ations. The currentmembers contribute a monthly amount to the family fund. = Only truedescendants are included in the family list, no wives, no husbands= .There are two tables 1- Names with the following fields: idno (unique) --family member parentid -- id number of the parent who connected the child to the family etc etc 2=E2=80=93 Contributions with fields: idno etc etc NowI want to report Names and contributions par family tree: My ideal isto = list grandfather, father, children based on the two fields (id,parentid).= =20 Any suggestions?=20 Thanks in advance =20 ------=_Part_8873312_1844400231.1696511707261 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I suppose you ought to be us= ing, recursive CTE queries

=
Documentation can be found at:=  7.8. WITH Queries (Common Table Expressions)




=20
=20
On Thursday, 5 October 2023 at 16:44:46 GMT+5:45, Ibrah= im Shaame <ishaame@gmail.com> wrote:


=09 =09 =09 =09

I have a table of members of a large family extendending back to eight generations. The current members contribute a monthly amount to the family fund. Only true descendants are included in the family list, no wives, no husbands. There are two tables

1 - Names with the following fields:=09idno (unique) --family member

=09=09=09=09=09=09=09parentid -- id number of the parent who connected the child to the family

=09=09=09=09=09=09=09etc

=09=09=09=09=09=09=09etc

2 =E2=80=93 Contributions with fields:=09=09=09=09idno

etc

etc

Now I want to report Names and contributions par family tree: My ideal is to list grandfather, father, children based on the two fields (id, parentid).

Any sugge= stions?

Thanks in ad= vance


------=_Part_8873312_1844400231.1696511707261--