Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nbUyD-00073n-7k for pgsql-sql@arkaria.postgresql.org; Mon, 04 Apr 2022 22:14:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nbUyB-0007pK-Re for pgsql-sql@arkaria.postgresql.org; Mon, 04 Apr 2022 22:14:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nbUyB-0007p9-GG for pgsql-sql@lists.postgresql.org; Mon, 04 Apr 2022 22:14:43 +0000 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nbUy2-0002Pp-Ee for pgsql-sql@lists.postgresql.org; Mon, 04 Apr 2022 22:14:41 +0000 Received: by mail-ed1-x52e.google.com with SMTP id c42so5350362edf.3 for ; Mon, 04 Apr 2022 15:14:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=1Gap/LPi33RNNNg0pJnWgOtQN/nqf/9pnVRFDu/jsX0=; b=UciMpYVwF5XLAwGq6AAQUH6CTB9K27fLWaQnA3L5P1FbrvI5rQT+rjhpTaESqdH66P M17bF9XOUHAdCjAmkQwVfHe+A6IAlMRLqVacoXzwKLhMBBRHBmpl2loXPBh8igeb61yK N9GJFGTYQAkC9F/xkmNk0ZjaT0Wg6NKKfjc/py2jAxElgRhKlo8Eo0O/V7XOgvWLA13b 9rDCUht9urd1Yx+Gi4A2x0CmN58cygEWhnjOMmQFYI9bfxB9DjeFFDyklLGLDIUWIL/j 40MaKooUlKrRnnBCkFmx0aQjIhBwvoJvCsEieLzq5T8xqDMLt+2vFkowuQVLZ4MyPi5c hyJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=1Gap/LPi33RNNNg0pJnWgOtQN/nqf/9pnVRFDu/jsX0=; b=BhjevtWkTkbNV34uvSjNXgJAfY6EVyc7035Lp/hhbxGYbGvqZ33yrROiYHpOQGBECY 66YtOR00EncB7IAjj2tEQkBWuyiuSYboVz60Yb5Osw9pSjdoerRnE5kKDlpNyYi0Etro pYNq9CUmRkTzmXlhUNuPtOiaFNss+ue2kW1/6UhrxusYcha/RCCfTQ1QqUR2pw7Sn7cb gbs1Z0VUi3GMDTTjra2wBvGQ1qF+pA8ZZZm22xDfjwhQSzs4S00G63F3F5JJTd4JedCl hv3patu0P+vtgAQns5BhX91+LyAsKrW7qc/Rwp+bK2Ysqx+/Q8iXzjV+ycg3TVBEH1Y+ roWg== X-Gm-Message-State: AOAM530kayZwbCx0I2c64rK9lqSndcrishSSYrZoiX1UFGbwipzPw4Fb bTw9l8dDP2p3KD+wNRcqSsDc2fMYuoCGB4dpgE4tayiw X-Google-Smtp-Source: ABdhPJyUdaCbwOJVIW6sZTMQNB6UxWXO3+oMB4zZpXWKXi6dO9Ah112QmWDqIwE9q4NC7rbaLK1oUhAVUtgi9F6yrhg= X-Received: by 2002:a50:8707:0:b0:41a:68df:1a6e with SMTP id i7-20020a508707000000b0041a68df1a6emr335527edb.31.1649110473308; Mon, 04 Apr 2022 15:14:33 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Shaozhong SHI Date: Mon, 4 Apr 2022 23:14:22 +0100 Message-ID: Subject: How to just get the last in a recursive query To: pgsql-sql Content-Type: multipart/alternative; boundary="000000000000f4fea605dbdb735d" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000f4fea605dbdb735d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable ---------- Forwarded message --------- From: Shaozhong SHI Date: Mon, 4 Apr 2022 at 23:13 Subject: How to just get the last in a recursive query To: PostGIS Users Discussion In this example, Network Walking in PostGIS =C2=B7 Paul Ramsey (cleverelephant.ca) 3 rows got returns as follows: id --- 6 3 1 How to just get the last (namely, 1) in the most efficient way? Regards, David --000000000000f4fea605dbdb735d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable





3 rows got returns as follows:

 id
---
  6
  3
  1

How to just get the last (namely, 1) in the most efficient way?
Rega=
rds, David
--000000000000f4fea605dbdb735d--