Re: Conditional return of aggregated data

From: Laura Smith <n5d9xq3ti233xiyif2vp(at)protonmail(dot)ch>
To: Ravi Krishna <srkrishna(at)myself(dot)com>
Cc: postgre <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Conditional return of aggregated data
Date: 2019-12-02 12:05:33
Message-ID: 5SxiVL9RhGEtWNbFGaSgBdXfLZ42gr7xiAdGh2MGf0tXH7KcDKVwqLVKymHrod8BjCL59U8CC-Js_z99jQCZrTIPUCNN_jRyn_TJKBFxNdo=@protonmail.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
> 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.

Hi Ravi,

Thanks for helping show me the way. You're quite right, a CTE did the trick

Laura

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2019-12-02 12:08:01 Re: Conditional return of aggregated data
Previous Message Ravi Krishna 2019-12-02 11:56:58 Re: Conditional return of aggregated data