SQL and Group by
582588Aug 27 2008 — edited Aug 27 2008Hi all,
I have a query
SELECT schedule_id ,COLUMN_VALUE,player_team_coach,current_player_team_id
FROM stat_totals where SCHEDULE_ID = '20040809NFL--WASHINGTON0' AND COLUMN_ID ='FPLKICK_PR_YARD';
this returns me
schedule_id column_value player_team_coach team_id
20040809NFL--WASHINGTON0 11 13373 8831
20040809NFL--WASHINGTON0 15 1953480 8831
20040809NFL--WASHINGTON0 46 2026423 8810
for a given schedule there are only two teams playing.whenever team_id = 8831, i need 8810 column_values which is equal to 46
and whenever team_id = 8810 , i have to sum up all the column_values of 8831 which is 11+ 15=26 .
My output must look like the one below.
schedule_id sum( column_value) player_team_coach
8831 46 13373
8831 46 1953480
8810 26 2026423