I am trying to get the sum of a specified column, but I want to limit it for 5 first rows. I have tried to use the above code but it is not working, it does not limit but it show sum for all rows. Has anyone know any other methods?
Code: Select all
$sql = mysql_query("SELECT SUM(points) FROM users WHERE u_id = $user_id LIMIT 5");