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 1qsNN2-007maY-4F for pgsql-novice@arkaria.postgresql.org; Mon, 16 Oct 2023 13:10:55 +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 1qsNMz-000kxy-Tv for pgsql-novice@arkaria.postgresql.org; Mon, 16 Oct 2023 13:10:54 +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 1qsNMz-000kxi-LF for pgsql-novice@lists.postgresql.org; Mon, 16 Oct 2023 13:10:54 +0000 Received: from mail-oo1-xc2f.google.com ([2607:f8b0:4864:20::c2f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qsNMx-000kvx-PZ for pgsql-novice@lists.postgresql.org; Mon, 16 Oct 2023 13:10:53 +0000 Received: by mail-oo1-xc2f.google.com with SMTP id 006d021491bc7-57e40f0189aso2380503eaf.1 for ; Mon, 16 Oct 2023 06:10:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697461851; x=1698066651; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=sfGioMfDtK22zLxkqOZpaTCWwWFd9I6XW6hcNGVRoi0=; b=cRlh9hrLY0Vx/+hij048za036CWpaQAnEuTWT9+uV9BOFRpjB2aOpuDeVhUERJkGIi AqkfzTT8yCljYgDYjlcmvZcWRQoASLgW+2g/23/v5Do4VMJLMAjDOefRhB3pm0t09p5k d5USB+29X3xhiIadtmqm+vnvuOxkVb9bsSeivJ7Byy6N5IuXPlT4fqUbO75R54H/EWlx YM6zjoPo7YwDoe3gjUperU1PsTuQmbb4fJ+D5FUBvsBRMHZ9pIuWiKD8juiWs0oFa5uP 3u5fFaVv9xzp39vIa5srMGOeI3WYFAbUtOhXEWvmO0JXdow7Yq8G6HWjvUGHVN6OGdes GCCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697461851; x=1698066651; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sfGioMfDtK22zLxkqOZpaTCWwWFd9I6XW6hcNGVRoi0=; b=bwrEDx+4498NeaoRVkDWQX4yFM7eVu7gPB5K7Kgw5/6HbgCcugWz2RwnY1EmuhEzM3 umSdU7LzEdadLAyaZrnLj9XKT9LInEab49QBrlmGUlBRdVv9E3af58FhrY8AEQ0qsu6E G/yN6gtRjxKUGRRblNhZq22wV+WRVssT9IJkVoKnian3/DvWsr+4joLk6i5CZJwFcf3o R+HyL9VQ1Zs09SwXk9w++XLkkH+TwpAozPV9S+ZU5RxSwBojrUrs38aVfSgppV+AfJ/Q e9U+OVylNOnk5c2WkNAdSizMi+rgiv0FF32tQ2t9hIk749t+di48WFUGMiuKoNtfUpeg xHOA== X-Gm-Message-State: AOJu0YwG4HdeJn4Z2NxjKNY5cTxvqRQOmLAT24jI70vXhbGoh2xQyJer gfSscpiMkSSbjd9kjey9si4wzb0nFa2VC8c0B60= X-Google-Smtp-Source: AGHT+IFrRdLrF2aNbLirARatiQnXI6rVdSqxYDeOpmQKc1Oylb2wlQ3ml6V67FKq/41T9q8EPrgwgBXswDuxYRDF9mI= X-Received: by 2002:a4a:868c:0:b0:57b:7b1b:108a with SMTP id x12-20020a4a868c000000b0057b7b1b108amr21950290ooh.8.1697461851037; Mon, 16 Oct 2023 06:10:51 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a8a:ecb:0:b0:4f6:384b:17ef with HTTP; Mon, 16 Oct 2023 06:10:50 -0700 (PDT) In-Reply-To: References: <1901532185.8873313.1696511707263@mail.yahoo.com> From: "David G. Johnston" Date: Mon, 16 Oct 2023 06:10:50 -0700 Message-ID: Subject: Re: Reporting by family tree To: Ibrahim Shaame Cc: swastik Gurung , "pgsql-novice@lists.postgresql.org" Content-Type: multipart/alternative; boundary="000000000000a6a5890607d522d9" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000a6a5890607d522d9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Monday, October 16, 2023, Ibrahim Shaame wrote: > Thanks David for the reply. But I think you missed part of the code, whic= h > refers to ukoo: > ) > > SELECT g.jina AS jina_la_mtoto, > g.baba AS baba_wa_mtoto, > g.babu AS babu_wa_mtoto, > g.namba, > mzazi.jina AS jina_la_mzazi, > mzazi.baba AS jina_la_baba_la_mzazi, > g.daraja > FROM ukoo g > JOIN majina2 mzazi > ON g.namba =3D mzazi.namba > ORDER BY g.namba; > > Any suggestion? > That part of the query is outside the CTE and thus doesn=E2=80=99t impact t= he CTE=E2=80=99s results. The part of the query that needs to be self-referencing is the subquery inside the CTE under the Union All. David J. --000000000000a6a5890607d522d9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Monday, October 16, 2023, Ibrahim Shaame <ishaame@gmail.com> wrote:
Thanks David for the reply. But I think you missed = part of the code, which refers to ukoo:
)
=C2=A0
SELECT =C2= =A0g.jina AS jina_la_mtoto,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 g.baba AS baba_w= a_mtoto,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 g.babu AS babu_wa_mtoto,
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 g.namba,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 mzazi.jina AS = jina_la_mzazi,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 mzazi.baba AS jina_la_baba_la= _mzazi,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 g.daraja
FROM ukoo g
JOIN maji= na2 mzazi
ON g.namba =3D mzazi.namba
ORDER BY g.namba;

=
Any suggestion?

That= part of the query is outside the CTE and thus doesn=E2=80=99t impact the C= TE=E2=80=99s results.=C2=A0 The part of the query that needs to be self-ref= erencing is the subquery inside the CTE under the Union All.

=
David J.
=C2=A0
--000000000000a6a5890607d522d9--