Help with sum in joins

I have a table of teams and a table with handicaps and scores. I want to list the teams from one table and join it with the handicaps and scores from the other. I want to show only those teams from the identified $league.

This is what I have:

sql = “SELECT bc_teams.league, bc_teams.team, bc_teams.won, bc_teams.lost, bc_teams.place, bc_totals.team, SUM(bc_totals.t_pins), SUM(bc_totals.h_pins) FROM bc_totals INNER JOIN bc_teams ON bc_totals.team = bc_teams.team WHERE bc_league.league = '$league”

$result = mysql_query($sql) or die(mysql_error())
while ($row = mysql_fetch_array($result)){

I get just one line and I need rows.

you already have the while look, just reference the totals like you would any other field - $row[‘h_pins’] and $row[‘t_pins’].

Sponsor our Newsletter | Privacy Policy | Terms of Service