percentages of a column

From: Andreas <maps(dot)on(at)gmx(dot)net>
To: PostgresSQL list <pgsql-sql(at)postgresql(dot)org>
Subject: percentages of a column
Date: 2007-06-30 02:14:28
Message-ID: 4685BC84.2090106@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

There is a Select that calculates some SUMs of objects.
I'd like to show a list of counts and percentages of this counts based
on the sum of all counts.
Is that possible in a SELECT statement?

Example:

Fruit Count %
--------------------------
Bananas 5 10%
Apples 15 30%
Oranges 30 60%

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Gregory Stark 2007-06-30 04:15:43 Re: percentages of a column
Previous Message Oleg Bartunov 2007-06-29 07:31:09 Re: Is index usage in LIKE-queries with UTF-8 implemented in PG-8.3 ?