lowe_22 Posted December 28, 2006 Share Posted December 28, 2006 Hi,I've got a table in my database which has a user name then three other columns, each column is the number of first/second/third place wins in a competetion (respectively). I want to be able to have some kind of running total column that adds up all the numbers from each preceding column for each member.I know this is not possiuble in MySQL as it is a not a dynamic language. My end results, however, is to output (via PHP) the membername with the most wins - starting with the most first place wins, then the second wins then the third. Understand?So its not just a case of the person with the most placings wins - butthe person with the highest number of 1st place, tehn 2nd place, then 3rd place wins?Any ideas? Link to comment https://forums.phpfreaks.com/topic/32035-getting-a-cumulative-total-of-the-three-preceding-columns-in-mysql/ Share on other sites More sharing options...
Barand Posted December 28, 2006 Share Posted December 28, 2006 [code]SELECT name, first, second, third, (first+second+third) as totalFROM mytableORDER BY total DESC, first DESC , second DESC, third DESC[/code] Link to comment https://forums.phpfreaks.com/topic/32035-getting-a-cumulative-total-of-the-three-preceding-columns-in-mysql/#findComment-148695 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.