Table of results SQL squery
Posted on 2003-03-16
I have a table of results for a sports club with 3 teams. The table headings are :-
TeamId, Point_For, Point_Against, Played, Outcome. Where outcome can be either Won/Lost/Draw or cancelled.
The table should look like :-
T PF PA Pl W L D
1st - 500 - 100 - 25 - 20 - 3 - 2
2nd - 300 - 200 - 25 - 15 - 10 - 0
3rd - 420 - 200 - 25 - 18 - 5 - 2
The query I have at the moment sort the first 4 columns, but I can't get it to count the outcomes and seperate them into the respective colums W/L/D.
SELECT TeamID, count(Result_For), sum(result_for), sum(Result_against)
GROUP BY TeamID;
Hope that makes sense, can anyone help?