SELECT money, bank FROM stats ORDER BY money+bank DESC LIMIT 7
Is this at all possible? If so how would i go about doing it. I would like to select the top 7 richest players in my game. Hopefully you know where im going with this.
| SitePoint Sponsor |
SELECT money, bank FROM stats ORDER BY money+bank DESC LIMIT 7
Is this at all possible? If so how would i go about doing it. I would like to select the top 7 richest players in my game. Hopefully you know where im going with this.




With my limited knowledge i think this is possible i seem to remember reading a similair post yesterday but alas, i cannot find it![]()
From what i remember, you need to assign bank and money to variables, $bank, $money, and then add them in the query, orbefore the query maybe???.......or similar.......PHP Code:SELECT money, bank FROM stats ORDER BY $money+$bank DESC LIMIT 7
![]()
That should work for youPHP Code:SELECT money, bank FROM stats ORDER BY money, bank DESC LIMIT 7 ;
Sarah
Regular user





in MSSQL this would be stated as:
SELECT TOP 7 money, bank FROM stats ORDER BY money+bank DESC
Bookmarks