U kunt uw zoekopdracht vereenvoudigen en MINSTE functie
SELECT USERid, LEAST(7, COUNT(*))
FROM table
GROUP BY USERid
van de vraag in je opmerking
SELECT SUM(countByUser)
FROM
(SELECT LEAST(7, COUNT(*)) as countByUser
FROM table
GROUP BY USERid) c