valtido Posted July 29, 2008 Share Posted July 29, 2008 Hi i have to columnt e.g. "NumberOfHits" and "points"... im looking to select the record and order them by the difference between the two e.g. "SELECT * FROM users ORDER BY average(points,numberOfHits) DESC LIMIT 10"; is there away to do this? to order them by those who have a higher average number.x Quote Link to comment Share on other sites More sharing options...
obsidian Posted July 29, 2008 Share Posted July 29, 2008 "Difference between the two" implies that you are subtracting one from the other. If this is the case, you may be able to get by with this: SELECT *, (points - numberOfHits) AS diff FROM users ORDER BY diff DESC LIMIT 10; Quote Link to comment Share on other sites More sharing options...
valtido Posted July 29, 2008 Author Share Posted July 29, 2008 if i want to find the average between the two then i would have to divide points by hits gives me the average, but that gives me irregular order... Quote Link to comment Share on other sites More sharing options...
valtido Posted July 29, 2008 Author Share Posted July 29, 2008 I think i have solved it lol thank u v much 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.