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? Quote Link to comment 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] Quote Link to comment 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.