pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rich Shepard <rshepard@appl-ecosys.com>
To: PostgreSQL General <pgsql-general@lists.postgresql.org>
Subject: Re: Counting number of sites with same number of sampling dates
Date: Wed, 11 Dec 2019 13:09:48 -0800 (PST)
Message-ID: <alpine.LNX.2.20.1912111308280.10822@salmo.appl-ecosys.com> (raw)
In-Reply-To: <CAHOFxGr4FZEsb5LHTec22UZZ+hXuX6ZbOH-R8Cj2u7OG43uTaw@mail.gmail.com>
References: <alpine.LNX.2.20.1912111226300.10822@salmo.appl-ecosys.com>
	<CAHOFxGr4FZEsb5LHTec22UZZ+hXuX6ZbOH-R8Cj2u7OG43uTaw@mail.gmail.com>

On Wed, 11 Dec 2019, Michael Lewis wrote:

> Put what you have in a subquery and group/aggregate again.
>
> select sample_count, count( site_nbr ) FROM (
> select site_nbr, count(distinct sampdate) AS sample_count from wrb_hg_cong
> group by site_nbr order by site_nbr
> ) sub
> group by sample_count;

Michael,

Well, darn! I totally speced using a subquery. Thank you very much for an
important lesson.

Best regards,

Rich





view thread (4+ messages)  latest in thread

Message-ID: <alpine.LNX.2.20.1912111308280.10822@salmo.appl-ecosys.com>
Permalink:  ../alpine.LNX.2.20.1912111308280.10822@salmo.appl-ecosys.com/
Also on:    postgresql.org/message-id/alpine.LNX.2.20.1912111308280.10822@salmo.appl-ecosys.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: rshepard@appl-ecosys.com
  Subject: Re: Counting number of sites with same number of sampling dates
  In-Reply-To: <alpine.LNX.2.20.1912111308280.10822@salmo.appl-ecosys.com>
  References: <alpine.LNX.2.20.1912111226300.10822@salmo.appl-ecosys.com> <CAHOFxGr4FZEsb5LHTec22UZZ+hXuX6ZbOH-R8Cj2u7OG43uTaw@mail.gmail.com> <alpine.LNX.2.20.1912111308280.10822@salmo.appl-ecosys.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