Order by the total of two entries?
Posted 12 December 2005 - 07:13 AM
I have ten people in a database, these ten people have a bank account and a wallet. I would like to order these ten people by the total of their bank account and wallet. Is that possible with just an SQL query or will I have to write some sort of PHP array sorting system?
Sorry if this is the wrong forum, the only other forum that it looked like it belonged in was PHP Newbies but since this is an SQL question I thought it probably belongs here. Also sorry if this is explained somewhere I didn't really know what to look for, like I said, novice. Any help is appriciated.
Posted 12 December 2005 - 04:33 PM
or [php] * 1000... PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...
Posted 12 December 2005 - 07:26 PM
[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] *, bank+wallet AS totalAmt FROM users ORDER BY totalAmt [!--sql2--][/div][!--sql3--]
Thank you so much, ryanlwh. You're a life saver. I wish I could hug you.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users