Use WHERE on result of SUM
Just change it to INNER JOIN

SELECT u.username,SUM(kort) as total
FROM user as u 
INNER JOIN userresult as r 
on u.userID = r.userID  
WHERE r.date &gt;= '$date' 
group by u.userID
order by total DESC;


or put the WHERE clause in the HAVING aggregation

SELECT u.username,SUM(kort) as total
FROM user as u 
LEFT JOIN userresult as r 
on u.userID = r.userID  
WHERE r.date &gt;= '$date' 
group by u.userID
HAVING SUM(kort) &gt; 0;


or put the whole thing in a subquery and test the total outside the subquery

SELECT * FROM
(
    SELECT u.username,SUM(kort) as total
    FROM user as u 
    LEFT JOIN userresult as r 
    on u.userID = r.userID  
    WHERE r.date &gt;= '$date' 
    group by u.userID
    order by total DESC
) A WHERE total &gt; 0;


The simplest and most sensible is the INNER JOIN