Re: Conditional return of aggregated data

Laura Smith <[email protected]>
Newsgroups gmane.comp.db.postgresql.general
Message-ID <5SxiVL9RhGEtWNbFGaSgBdXfLZ42gr7xiAdGh2MGf0tXH7KcDKVwqLVKymHrod8BjCL59U8CC-Js_z99jQCZrTIPUCNN_jRyn_TJKBFxNdo=@protonmail.ch>
>
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.