Group By question

From: Jeff Lanzarotta <delux256-postgresql(at)yahoo(dot)com>
To: PostgreSQL GENERAL List <pgsql-general(at)postgresql(dot)org>
Subject: Group By question
Date: 2007-10-16 14:46:34
Message-ID: 10823.91080.qm@web36814.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I have a table that looks something like this:

SKU Dept Col1 Col2 Col3
------- ------ ------- ------- ------
1 1 1 2 3
2 1 2 3 4
3 2 1 0 1
4 2 0 1 2
5 2 4 1 3
6 3 1 2 3

I am having a problem trying to get the Is there a query that can do something like this:

select sku, dept, (col1 + col2) * col3) from table group by dept

Ideas?

-Jeff

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2007-10-16 15:06:11 Re: Group By question
Previous Message Chris Mair 2007-10-16 14:45:47 Re: PostgreSQL as a backend for Wizcon 9.2