Problems with select statement

From: phil campaigne <pcampaigne(at)charter(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Problems with select statement
Date: 2005-02-20 19:13:53
Message-ID: 4218E171.70605@charter.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,
I'm haveing trouble writing a select statement that gives me a resulting
row like this:
player_number, player name,a,c,t, (total of a+c+t).

here's what I have so far but it puts the a,c,t in separate rows.

hardwoodthunder=# select (select player_points where aspect='A') as
A,(select player_points where aspect='C') as C, (select player_points
where aspect='T') as T, player_number, player_name
from (select * from player as a, teamshare as b where
a.player_number=b.player) as c;
a | c | t | player_number | player_name
------+------+-----+---------------+-------------
0.27 | | | 42 | S. Randolph
| 0.33 | | 42 | S. Randolph
| | 0.8 | 42 | S. Randolph
0.54 | | | 42 | S. Randolph
| 0.66 | | 42 | S. Randolph
| | 0.8 | 42 | S. Randolph
0.27 | | | 40 | R. Perkins
| 0.33 | | 40 | R. Perkins
(8 rows)
Any ideas on how to consolidate the rows?
thanks in advance,
Phil Campagine

Browse pgsql-general by date

  From Date Subject
Next Message Phil Endecott 2005-02-20 19:30:33 Re: Triggers, again.. ;-)
Previous Message Larry Rosenman 2005-02-20 17:05:44 Re: Scalability with large numbers of tables