OutOfInk Posted April 23, 2014 Share Posted April 23, 2014 I want to ORDER my results by the amount of credits a user has so we can see who is on the leaderboard placings. The problem is I need to have an addition as there new bet must be included in the result to make the results true; is there something that works like follows? ORDER BY `tableA.credits` + `tableB.newBet` LIMIT 0,150 using a join with an addition? Quote Link to comment https://forums.phpfreaks.com/topic/287968-ordering-results-with-an-addition-on-two-talbles/ Share on other sites More sharing options...
analyzethism1 Posted April 24, 2014 Share Posted April 24, 2014 Yes, join the tables so that both are included in the same query and then order by the total of those two columns. ORDER BY ( `tableA.credits` + `tableB.newBet`) LIMIT 0,150 Quote Link to comment https://forums.phpfreaks.com/topic/287968-ordering-results-with-an-addition-on-two-talbles/#findComment-1477171 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.