sql question

From: u95886230(at)spawnkill(dot)ip-mobilphone(dot)net
To: pgsql-general(at)postgresql(dot)org
Subject: sql question
Date: 2001-05-13 18:45:05
Message-ID: l.989779505.1960693359@[212.171.170.132]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Please help, I am trying to write an SQL statement but with no success as I am just
starting out with sql.

I have a table with 3 columns: Account# ,OrderType and date
example of data:
Account# ¦ Ordertype ¦ Date
1 ¦ A ¦ April
1 ¦ B ¦ May
1 ¦ B ¦ May
2 ¦ B ¦ April
2 ¦ B ¦ May
2 ¦ C ¦ May
3 ¦ C ¦ May

I need to write a select that will show me the totals of EACH type for EACH account AND
total ordersplaced for a SPECIFIC month eg..Show me the results for May...

account ¦ TotA ¦ TotB ¦ TotC ¦ Total
1 ¦ 0 ¦ 2 ¦ 0 ¦ 2
2 ¦ 0 ¦ 1 ¦ 1 ¦ 2
3 ¦ 0 ¦ 0 ¦ 1 ¦ 1

I can use temp tables, but need a solution written as basic as pssible so I can understand
it (all in the form select this from that)
any help would be fantastic as I am completely stuck and have been trying for about a week

thanks
sgebbie(at)ciaoweb(dot)it

--
Sent by sgebbie from ciaoweb piece from it
This is a spam protected message. Please answer with reference header.
Posted via http://www.usenet-replayer.com/cgi/content/new

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Louis-David Mitterrand 2001-05-13 20:36:23 Re: Invoices
Previous Message Simon Crute 2001-05-13 17:44:44 problems with timestamp fields