Re: Creating Report for PieChart
| От | Bruce Momjian |
|---|---|
| Тема | Re: Creating Report for PieChart |
| Дата | |
| Msg-id | 20151014005744.GA7843@momjian.us обсуждение исходный текст |
| Ответ на | Creating Report for PieChart (Alex Magnum <magnum11200@gmail.com>) |
| Список | pgsql-general |
On Wed, Oct 14, 2015 at 01:56:11AM +0200, Alex Magnum wrote: > Hello, > I need to process some statistics for a pie chart (json) where I only want to > show a max of 8 slices. If I have more data points like in below table I need > to combine all to a slice called others. If there are less or equal 8 i use > them as is. > > I am currently doing this with a plperl function which works well but was just > wondering out of curiosity if that could be done withing an sql query. > > Anyone having done something similar who could point me in the right direction? I think you want the HAVING clause, e.g. HAVING COUNT(*) > 8. -- Bruce Momjian <bruce@momjian.us> http://momjian.us EnterpriseDB http://enterprisedb.com + As you are, so once was I. As I am, so you will be. + + Roman grave inscription +
В списке pgsql-general по дате отправления: