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 1qvgVz-006cMN-M5 for pgsql-novice@arkaria.postgresql.org; Wed, 25 Oct 2023 16:13:51 +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 1qvgVx-005qiy-P7 for pgsql-novice@arkaria.postgresql.org; Wed, 25 Oct 2023 16:13:49 +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 1qvgVx-005qip-GN for pgsql-novice@lists.postgresql.org; Wed, 25 Oct 2023 16:13:49 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qvgVu-002GTq-TI for pgsql-novice@lists.postgresql.org; Wed, 25 Oct 2023 16:13:48 +0000 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-507ac66a969so7845643e87.3 for ; Wed, 25 Oct 2023 09:13:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698250425; x=1698855225; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ky1nb0vtWA4P4C2CT0ZIzteqWtKBbz52Ayb/bMrR2mA=; b=Gh2slCTxa4sQV7y5WJRVGejsfRjpcXNXDt1+6AUUVfip/uGhkEUF4Wi4LQMQPnU7ew xfssou3l9uh0j3jOsaPiTLbhwUnvK7Q7bKEH5QukSl3mtNgOE6CLONPDKu63W8/XnAHF 1cX2wiZ1JUqjyevQXoJl900W9Hxi0J/Uzbhnoo10IyhzFho4BeD7s64rZ6jEj041TR+u E+cLemi6ioNjiRApbRxe5dM7PmNFWf6kpgthvKDkeCbCgPLSwBXtPW5E30/HXW/k1wXj qK6aqZDREEbFVzacfsQQtOMWurHIDQ8rKDs1Pmdnihqss9/EhBIECtUHLHqMpP4bfqXa HwTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698250425; x=1698855225; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ky1nb0vtWA4P4C2CT0ZIzteqWtKBbz52Ayb/bMrR2mA=; b=AqsI2ADqvyEBYDsm0P+3zvZZau1MNsn3B7NQen4pHN7OOXr6HJkoE1S0lNkVZ3CX/9 E5Y/zpWJCAH6+94zMeDzPoTloYftY+3xcCjt9KYXsq/6lMrI0K9PADOO7RaSN8mFIeys 8oQZpVVI7cXRG28Z6SgQ2/vC+llMAW3be0ci0k9DrsOTAKa6Sm5PZSM1a7B/BcbgKiKd kIeWbOznvv9n3ru5yRkGe+e7aLwVX7JbejaUSyFS9wGSP9E+Y3omQaAVBBdRkN96z5TC Krs6d9xO+7kKP2S4WUPLoO0lxdL8xO6N52rPt2gyxfnMKUvPFzQD2RnTtN9LI7aZ80Y9 BH2A== X-Gm-Message-State: AOJu0YyKAAuO2OjDyndQnjlJ3d9a+X0AQF/AlrseVvt9q9MD0cpgjpui 9KQBJwepM2c17NohKbJ/Wci+9RpwarsBIegaTUI= X-Google-Smtp-Source: AGHT+IF1gEYhcI0HDBxiTXYFfyBesFMSZgEk/s+2VPwBHZEPkWAG4Om0pHy27b7B8Ocu7AiTuuQ7iDm7rMGgvSLwaxE= X-Received: by 2002:ac2:4a70:0:b0:507:a8ed:ee0b with SMTP id q16-20020ac24a70000000b00507a8edee0bmr10798033lfp.65.1698250424650; Wed, 25 Oct 2023 09:13:44 -0700 (PDT) MIME-Version: 1.0 References: <1901532185.8873313.1696511707263@mail.yahoo.com> <1653003450.12126241.1697462972371@mail.yahoo.com> In-Reply-To: From: o1bigtenor Date: Wed, 25 Oct 2023 11:13:08 -0500 Message-ID: Subject: Re: Reporting by family tree To: "David G. Johnston" Cc: Ibrahim Shaame , swastik Gurung , "pgsql-novice@lists.postgresql.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Oct 25, 2023 at 9:55=E2=80=AFAM David G. Johnston wrote: > > On Wed, Oct 25, 2023 at 5:21=E2=80=AFAM Ibrahim Shaame wrote: >> >> But what I want to get is grandfather - father - children: >> >> 1 - Grandfather1 >> >> 3 - father1-1 >> >> 6 - son1-1 >> >> 7 =E2=80=93 son1-2 >> >> 4 - Father1-2 >> >> 8 - son2-1 >> >> 2 =E2=80=93 Grandfather2 >> >> 5 - Father2-1 >> >> etc >> >> >> Any suggestion >> > > If you want a different ordering of the output change the ORDER BY specif= ication. > > Specifically, you want to order by the path of each person. Since that c= an only be determined during the traversal you need to create the path data= yourself. I suggest using an integer[] (integer array) to store the path = using ID values as breadcrumbs. > > (Not the OP just someone following the list trying to learn.) 'using ID values as breadcrumbs' - - - can I interpret that to mean the ordinal numbers 1-8 listed (more implied)? TIA