Re: Conditional return of aggregated data

From: "Ravi Krishna" <srkrishna(at)myself(dot)com>
To: "Ravi Krishna" <srkrishna(at)myself(dot)com>
Cc: n5d9xq3ti233xiyif2vp(at)protonmail(dot)ch, postgre <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Conditional return of aggregated data
Date: 2019-12-02 11:56:58
Message-ID: trinity-d51ed061-8e4e-47ba-b2e7-3f848e78588a-1575287818540@3c-app-mailcom-lxa04
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


>
> > My initial idea was something along the lines of :
> > select (select sum(statcount) from stats_residence) as aggstat,statcount,short_name_en from stats_residence where aggstat>some_number;
>
> Am I missing something basic. The above can be done using
> GROUP BY and HAVING clause.
or this
with t as
(select (select sum(statcount) from stats_residence) as aggstat,
statcount,short_name_en from stats_residence
)
select * from t where aggstat > some_number

Apology if I did not understand the question correctly.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laura Smith 2019-12-02 12:05:33 Re: Conditional return of aggregated data
Previous Message Ravi Krishna 2019-12-02 11:52:49 Re: Conditional return of aggregated data