Welcome Guest, Not a member yet? Register   Sign In
Calculate position based on a value
#3

(This post was last modified: 12-15-2015, 12:22 AM by Violette.)

Thank you for your answer.

After correction, I have a new error:

Unknown column '?' in 'where clause'


Why can not I do it?

Code:
SELECT a1.from_user_id, a1.total_stats, COUNT(a2.total_stats) position
FROM score a1, score a2
WHERE a1.total_stats <= a2.total_stats AND a1.from_user_id=?
GROUP BY a1.from_user_id, a1.total_stats
ORDER BY a1.total_stats DESC, a1.from_user_id DESC


because this function does not return any results me:
Code:
SELECT from_user_id, total_stats, COUNT( total_stats ) AS position
FROM score
WHERE total_stats <= position
AND from_user_id =25030
GROUP BY from_user_id, total_stats
ORDER BY total_stats DESC , from_user_id DESC

Does there another solution to create a ranking?

Could you help me please ?
Reply


Messages In This Thread
Calculate position based on a value - by Violette - 12-14-2015, 08:09 AM
RE: Calculate position based on a value - by Violette - 12-15-2015, 12:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB