Re: [GENERAL] devide and summarize sql result (all)

2013-08-16 Thread salah jubeh
Hello, Use a view Regards From: Janek Sendrowski To: pgsql-general@postgresql.org Sent: Friday, August 16, 2013 11:55 AM Subject: Re: [GENERAL] devide and summarize sql result (all) Thanks for your Answers,   my problem is, that there is no column

Re: [GENERAL] devide and summarize sql result (all)

2013-08-16 Thread Janek Sendrowski
m 00:24 Uhr Von: bricklen An: "Janek Sendrowski" Cc: "pgsql-general@postgresql.org" Betreff: Re: [GENERAL] devide and summarize sql result (all) On Thu, Aug 15, 2013 at 1:51 PM, Janek Sendrowski <jane...@web.de> wrote: Hi,   My sql query results sth. like t

Re: [GENERAL] devide and summarize sql result (all)

2013-08-15 Thread Beena Emerson
Hi Janek, You can try: =# SELECT name, perc/5*5 || '-' || perc/5*5+5 AS range, count(*) as matches FROM test GROUP BY name, perc/5 ORDER BY perc/5; name | range | matches ---++- franz | 75-80 | 1 jason | 75-80 | 1 franz | 80-85 | 1 smith | 85-90 |

Re: [GENERAL] devide and summarize sql result (all)

2013-08-15 Thread bricklen
On Thu, Aug 15, 2013 at 1:51 PM, Janek Sendrowski wrote: > Hi, > > My sql query results sth. like this: > > user percentage > franz 78% > smith 98% > franz 81% > jason 79% > smith 89% > smith 85% > smith 99% > > Now I'd like to summarize the percentages oder every user like this. > smith > 2 matc

[GENERAL] devide and summarize sql result (all)

2013-08-15 Thread Janek Sendrowski
Hi,   My sql query results sth. like this:   user percentage franz 78% smith 98% franz 81% jason 79% smith 89% smith 85% smith 99%   Now I'd like to summarize the percentages oder every user like this. smith 2 matches 95-100% 2 matches 85-95% 0 mathes 75-85%   franz 0 mathes 95-100% ..