Problems with select statement - Mailing list pgsql-general

From phil campaigne
Subject Problems with select statement
Date
Msg-id 4218E171.70605@charter.net
Whole thread Raw
List 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


pgsql-general by date:

Previous
From: "Larry Rosenman"
Date:
Subject: Re: Scalability with large numbers of tables
Next
From: Phil Endecott
Date:
Subject: Re: Triggers, again.. ;-)