Thread: Problems with select statement

Problems with select statement

From
phil campaigne
Date:
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