JamesTalbot Posted September 30, 2007 Share Posted September 30, 2007 Hello, I run a league for a online game and i would like to add a Countries Standings where you can see which country is the best. I have a users table with the column Username, Country, Wins, Losses, Points, Played. I would like to know how i add up each of the rows where the country is say "United Kingdom" etc etc . Your help is greatly appreciated. Thanks, James Quote Link to comment https://forums.phpfreaks.com/topic/71289-adding-sql-results/ Share on other sites More sharing options...
shocker-z Posted September 30, 2007 Share Posted September 30, 2007 SQL SELECT Country, count(Country) as `Countrycount` FROM subissues GROUP BY Country ORDER BY Countrycount DESC; That will return the quantity of records per each Country and order descending. Regards Liam Quote Link to comment https://forums.phpfreaks.com/topic/71289-adding-sql-results/#findComment-358605 Share on other sites More sharing options...
JamesTalbot Posted September 30, 2007 Author Share Posted September 30, 2007 Hi Thanks for that however still a few questions. That query lists the countries however it only show 1 user's points/wins/games/losses eg. 1 United Kingdom - L4LoKul2A 6 9 5 1 2 France - Darkmaul 6 6 4 2 3 Germany - Tower 4 2 2 2 4 Poland - nano 2 1 1 1 5 Italy - Face 0 0 0 0 How do i add all the users points together and group by country? Thanks! James Quote Link to comment https://forums.phpfreaks.com/topic/71289-adding-sql-results/#findComment-358662 Share on other sites More sharing options...
JamesTalbot Posted October 1, 2007 Author Share Posted October 1, 2007 Anyone? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/71289-adding-sql-results/#findComment-359070 Share on other sites More sharing options...
fenway Posted October 1, 2007 Share Posted October 1, 2007 SUM()? Quote Link to comment https://forums.phpfreaks.com/topic/71289-adding-sql-results/#findComment-359100 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.