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 1oNgpz-000248-C5 for pgsql-general@arkaria.postgresql.org; Mon, 15 Aug 2022 20:37:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oNgpy-0002WS-3R for pgsql-general@arkaria.postgresql.org; Mon, 15 Aug 2022 20:37:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oNgpx-0002WJ-Ec for pgsql-general@lists.postgresql.org; Mon, 15 Aug 2022 20:37:25 +0000 Received: from antelope.elm.relay.mailchannels.net ([23.83.212.4]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oNgpq-00020w-1R for pgsql-general@lists.postgresql.org; Mon, 15 Aug 2022 20:37:24 +0000 X-Sender-Id: a2hosting|x-authuser|pedz+easesoftware.com@mi3-ss4.a2hosting.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 7BF8A12274F; Mon, 15 Aug 2022 20:37:14 +0000 (UTC) Received: from mi3-ss4.a2hosting.com (unknown [127.0.0.6]) (Authenticated sender: a2hosting) by relay.mailchannels.net (Postfix) with ESMTPA id E3540122099; Mon, 15 Aug 2022 20:37:13 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1660595834; a=rsa-sha256; cv=none; b=QJmP3rPklZc7hyskc3ZT/p35zWojIoG3a+4Iw4PutWVL/q+c2goVjcY3qb41gpZvyUFik7 YwOOB/KLe9esLSNtB512dZIXSQJj/+W4zmPL0//v7HybiLKYJfIdeZ92P2qWoLzMFJF+aP Q9l0eBnkgTL372RIhYO3rl10zofgQ/6sb9EuO3GJIfMOlC45QOMqQjKEIrKqEYe69kFV2e CeUF2O7T/mwX57zvqw/c7kSTQYYGpDFJjxCveREGjn/p/nyStmKpP3nrkpmPJAP9CvIxI3 vfovpQWFqKvoeWLJeeyzGB7scaTqESIba3MQ1yPNQkYeYkWRjHaRG2Xtvotbtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1660595834; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=3LhD31x1erpjDaC4SFMJSAChNi9LpYicZqdkvUqiGE4=; b=A54M9CxHJJuwYTRP7zAX2vNI4TNUQIVJkCaTMclDytzRCxI26UiopjWZIuvnnvefyET7eq LIprGzy4mwAI6GR1FaamvCV6xlXI7DTdUyA+RrLkNWGYpEhdCO2lDVXlN9+MaA+/dkr0L1 8xsU/UNWKmPiwOdxOmyZgWzZiKoCDE6VRVBb0JJFZFzeroF28B/F505IAHBhBl1TBxNXlv IBdqRlGGGmP3A2q6nftwJ0nOPqAhzrpGc4NRFfEogpb1loknRS4Pk6rOq0XhGlSX/O5s80 BHVac/sy3g1HHjSLuhaK1w+nybv4KZDQ2+3YZCstVswjuP0SW4iFbAcaBcQILA== ARC-Authentication-Results: i=1; rspamd-7c478d8c66-7g62l; auth=pass smtp.auth=a2hosting smtp.mailfrom=pedz@easesoftware.com X-Sender-Id: a2hosting|x-authuser|pedz+easesoftware.com@mi3-ss4.a2hosting.com X-MC-Relay: Neutral X-MailChannels-SenderId: a2hosting|x-authuser|pedz+easesoftware.com@mi3-ss4.a2hosting.com X-MailChannels-Auth-Id: a2hosting X-Sponge-Harmony: 5677672567a2f3f0_1660595834312_1018372628 X-MC-Loop-Signature: 1660595834312:3065247218 X-MC-Ingress-Time: 1660595834311 Received: from mi3-ss4.a2hosting.com (mi3-ss4.a2hosting.com [68.66.200.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.110.28.254 (trex/6.7.1); Mon, 15 Aug 2022 20:37:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=easesoftware.com; s=default; h=References:To:Cc:In-Reply-To:Date:Subject: Mime-Version:Content-Type:Message-Id:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=3LhD31x1erpjDaC4SFMJSAChNi9LpYicZqdkvUqiGE4=; b=fiGJs/edPNlWM3zlhdM2dxCnrV rZgzMmULq+kPcwc3mzlMGlZAT0td4ZMeMYlJ5ztBXmxS0oj/VKdg3URP6XXaP2gtI4wHlFaubAqIj CiiiK75gL6TDZ/sV+m5gtG/V+4UsHVFM1nOsVWyRNMwFRWwkaTmCgOGW25E8ECPw849bwQ4tr1GLc 7hhtJc2E3EHPAfOzo6cHgdZ8RK1xxDZAVXogRVonuB3uFVWQb/QqcYS419Qu8EOvSdIrrZWNtv/eJ rEjswq9oETGNR5VHePt5jjujW+bQOrjaAaj1Auo25ftV/6O8XthgoU1OqfPJ5kZ2I+0ne3iBRnFTt o2M2zB+A==; Received: from cpe-70-94-128-193.satx.res.rr.com ([70.94.128.193]:56707 helo=smtpclient.apple) by mi3-ss4.a2hosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1oNgpk-000506-N9; Mon, 15 Aug 2022 16:37:12 -0400 From: Perry Smith Message-Id: <8D4B16FB-BE56-446E-BDE5-D12C69B2C3DB@easesoftware.com> Content-Type: multipart/signed; boundary="Apple-Mail=_F7B4C535-E2C6-405A-95FC-754B932EFBBE"; protocol="application/pgp-signature"; micalg=pgp-sha256 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: ***SPAM*** Re: Can I get the number of results plus the results with a single query? Date: Mon, 15 Aug 2022 15:37:12 -0500 In-Reply-To: Cc: pgsql-general list To: "David G. Johnston" References: <75BBE3C5-D495-47B8-A81C-6359391E3B99@easesoftware.com> X-Mailer: Apple Mail (2.3696.120.41.1.1) X-AuthUser: pedz+easesoftware.com@mi3-ss4.a2hosting.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_F7B4C535-E2C6-405A-95FC-754B932EFBBE Content-Type: multipart/alternative; boundary="Apple-Mail=_3E4EBDCD-3CFD-4D6E-A12E-45871B54BB78" --Apple-Mail=_3E4EBDCD-3CFD-4D6E-A12E-45871B54BB78 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Aug 15, 2022, at 08:55, David G. Johnston = wrote: >=20 > On Monday, August 15, 2022, Perry Smith > wrote: > I=E2=80=99ve been toying with row_number() and then sort by row_number = descending and pick off the first row as the total number. >=20 > Use count as a window function. I see others are commenting after David=E2=80=99s update so: Thank you David. This seems to work for me: SELECT count(*) OVER (), id, basename, sha1 FROM dateien WHERE = (lower(ext) in ( 'pxd' ) and ftype =3D 'file') ORDER BY sha1; This has, e.g. 73, in the first column for all of the rows. --Apple-Mail=_3E4EBDCD-3CFD-4D6E-A12E-45871B54BB78 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Aug 15, 2022, at 08:55, David G. Johnston <david.g.johnston@gmail.com> wrote:

On Monday, August = 15, 2022, Perry Smith <pedz@easesoftware.com> wrote:
I=E2=80=99ve been toying with row_number() and then sort by row_number = descending and pick off the first row as the total number. 

Use = count as a window function.

I see others are commenting after David=E2=80=99s = update so:

Thank you = David.

This seems to work for = me:

SELECT = count(*) OVER (), id, basename, sha1 FROM dateien WHERE (lower(ext) in ( = 'pxd' ) and ftype =3D 'file') ORDER BY = sha1;

This = has, e.g. 73, in the first column for all of the rows.

= --Apple-Mail=_3E4EBDCD-3CFD-4D6E-A12E-45871B54BB78-- --Apple-Mail=_F7B4C535-E2C6-405A-95FC-754B932EFBBE Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE5yOa/gCtQpb3oCpljxzk9yzE+MAFAmL6rngACgkQjxzk9yzE +MDEsg//QFtfcrEuZeZ6spNaxGr1GGji3PxdgXZER5AaP8NlHUqNBv943M8GC605 lztvG9nY1aQoGQhrRfKpfqUiXFHKDRL2kjyi4qa4InmiH2wvYP4bpA2tgQR/zsMf Dtj7Kc9udPtO9w6ToqV2/JzCCCVPtnlxQn0I8A/ITGeKKL8CREsFIh5Ua31UqWZi 9USaj4fgmvy90QF+YIybFN1iy+2GgmBCgUWlb2NWgF2wp9fMruO287DuRcqyB5jm DIfca0ll8jPvNvoYckrcDwIztUk7z9Ph7svgek3IMUmz0DzacGPN9Kg5XMw/KTdh mnVOz0kTeHmGWpeOE4Yup4BjWN5E640N+8JqslK3eRmzcwsqQZSWClcCbGx963FN Kf3snf0ZgOmiS4c8B0RIDhWhZHcmqbdiqPAuR3eHCYdFmvc4Ol5Q8lmXvfEFVimE JCyqhddRtFxoTB/DCHJDG/fKPYhiiFkMm/kOkQkuSr1QPZlIZ2zemjrw7qsANYUP NeRN12q03Z+2VQe54FzU4kpF+rcmPCws8LMJ65cUr2gzuP0QhkHDwaWSygjmM1bf wJG9Jtuw/el01d/p8pnNkc9yTiA1UlvZoSwAPlA0xL6dgF3y8GSpz0i5cehz0jiC DWH94ovnB6R97udyFzCpa77jgxcGarIidm82A7nO5JC0pNQdgJ8= =7RjA -----END PGP SIGNATURE----- --Apple-Mail=_F7B4C535-E2C6-405A-95FC-754B932EFBBE--