pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Perry Smith <pedz@easesoftware.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-general list <pgsql-general@lists.postgresql.org>
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
Message-ID: <8D4B16FB-BE56-446E-BDE5-D12C69B2C3DB@easesoftware.com> (raw)
In-Reply-To: <CAKFQuwYR-kmTsRJDQ-2US_KR1jvjORceUMsO5jv9duZBrtZqwg@mail.gmail.com>
References: <75BBE3C5-D495-47B8-A81C-6359391E3B99@easesoftware.com>
	<CAKFQuwYR-kmTsRJDQ-2US_KR1jvjORceUMsO5jv9duZBrtZqwg@mail.gmail.com>



> 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 <mailto:pedz@easesoftware.com>> wrote:
> I’ve 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’s 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 = 'file') ORDER BY sha1;

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

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (4+ messages)  latest in thread

Message-ID: <8D4B16FB-BE56-446E-BDE5-D12C69B2C3DB@easesoftware.com>
Permalink:  ../8D4B16FB-BE56-446E-BDE5-D12C69B2C3DB@easesoftware.com/
Also on:    postgresql.org/message-id/8D4B16FB-BE56-446E-BDE5-D12C69B2C3DB@easesoftware.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: pedz@easesoftware.com, david.g.johnston@gmail.com
  Subject: Re: ***SPAM***  Re: Can I get the number of results plus the results with a single query?
  In-Reply-To: <8D4B16FB-BE56-446E-BDE5-D12C69B2C3DB@easesoftware.com>
  References: <75BBE3C5-D495-47B8-A81C-6359391E3B99@easesoftware.com> <CAKFQuwYR-kmTsRJDQ-2US_KR1jvjORceUMsO5jv9duZBrtZqwg@mail.gmail.com> <8D4B16FB-BE56-446E-BDE5-D12C69B2C3DB@easesoftware.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox