All pastes #952014 Raw Edit

Andres

public text v1 · immutable
#952014 ·published 2008-03-21 20:52 UTC
rendered paste body
 what i get.

  select  b.WINS+a.WINS from 
  (select teams.tname, COUNT(*) WINS 
  from teams, results
  where teams.tname = results.home and results.hruns > results.vruns 
  group by teams.tname) b,
   (select tname,count(*) as WINS
  from teams, results
  where teams.tname=results.visitor and results.vruns > results.hruns
  group by teams.tname)a;

B.WINS+A.WINS
-------------
            3
            4
            4
            2
            4
            5
            6
            6
            4
            6
            3

B.WINS+A.WINS
-------------
            4
            4
            2
            4
            4
            5
            5
            3
            5


what i need to accomplish.

TEAM                       WINS    
-------------------- ---------- 
Cubs                          5        
Diamondbacks                  4         
Cardinals                     4          
Braves                        3          
Indians                       2