Hi,
Wondering if anyone can help me with the following:

   -

   Does anyone know how I can get the SUM() aggregate function within this
   SQLite statement?

   SELECT AwayTeam As 'Team', CASE WHEN AwayTeamScore > HomeTeamScore THEN
   3  WHEN AwayTeamScore=HomeTeamScore THEN 1 ELSE 0 END AS 'Points' FROM
   Results  UNION SELECT ALL HomeTeam As 'Team', CASE WHEN HomeTeamScore >
   AwayTeamScore THEN 3  WHEN HomeTeamScore=AwayTeamScore THEN 1 ELSE 0 END AS
   'Points' FROM Results ORDER BY Team"

   If I put it in each of the Select statements it doesn't give me the
   results expected; without the SUM in the statement, it's showing me each
   row as it should be, but I want to aggregate the results by TEAM.

   E.g.

   TEAM A 4 ( two records A-1 A-3)

   TEAM B 3 (one record B-3)

   TEAM C 0

   TEAM D 4 (two records D-1 D-3)

   Thanks for any suggestions, this is the last part I'm a bit stuck on.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to