Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Hannes
Starting Member
1 Post |
Posted - 2008-11-20 : 15:48:32
|
ID Date Home Away Pool H1s A1s H1b A1b1 2008/03/01 President Heidelberg 1 34 10 5 02 2008/03/01 Goudrif Vereeniging1 19 3 4 03 2008/03/01 Alberton Randburg 1 21 10 4 04 2008/03/08 Goudrif President 1 8 32 0 55 2008/03/08 Heidelberg Alberton 1 22 30 1 56 2008/03/08 Randburg Vereeniging1 34 0 5 07 2008/03/15 President Randburg 1 8 3 4 18 2008/03/15 Heidelberg Goudrif 1 23 0 4 09 2008/03/15 VereenigingAlberton 1 7 25 0 510 2008/03/18 VereenigingPresident 1 8 8 2 211 2008/03/18 Alberton Goudrif 1 26 0 5 012 2008/03/18 Randburg Heidelberg 1 15 22 1 413 2008/04/19 Alberton President 1 18 24 1 414 2008/04/19 VereenigingHeidelberg 1 7 22 0 415 2008/04/19 Randburg Goudrif 1 15 10 4 1Hi I want to show a score log to our school.The table above shows a series of games played. To determine the winner.You add all the points scored by a school and subtract the opponents score to determine the difference.You add all its bonus points and the winner is the one with the highest bonus points. If there is a drawthe one with the highest points difference wins. My problem lies in the same school sometimes plays at Home and others Away. Not only that butit has a Home score(H1s) and Away score(A1s) as well as a Home bonus(H1b) and Away bonus(A1b) SELECT Home, sum(H1s), sum(H1b)FROM [Sup62008].[dbo].[08B1]where Pool = 1Group by HomeUNIONSELECT Away, sum(A1s) as H1s, sum(A1b)as H1bFROM [Sup62008].[dbo].[08B1]where Pool = 1Group by AwayGives meHome (No column name) (No column name)Alberton 55 10Alberton 65 10Goudrif 10 1Goudrif 27 4Heidelberg 45 5Heidelberg 54 8President 42 9President 64 11Randburg 13 1Randburg 64 10Vereeniging 3 0Vereeniging 22 2Can someone give me a result ofAlberton 120 20President 106 20Heidelberg 99 13Randburg 77 11Goudrif 37 5Vereeniging 25 2Thanks I am using SQL 2005 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
|
|
|
|