pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas <maps.on@gmx.net>
To: PostgresSQL list <pgsql-sql@postgresql.org>
Subject: percentages of a column
Date: Sat, 30 Jun 2007 04:14:28 +0200
Message-ID: <4685BC84.2090106@gmx.net> (raw)

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%





view thread (2+ messages)  latest in thread

Message-ID: <4685BC84.2090106@gmx.net>
Permalink:  ../4685BC84.2090106@gmx.net/
Also on:    postgresql.org/message-id/4685BC84.2090106@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: maps.on@gmx.net
  Subject: Re: percentages of a column
  In-Reply-To: <4685BC84.2090106@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox