You haven;t mentioned the error. But I guess you will need to include mobileno in
Group By
statement as you are using it in the select statement. So your updated query will be:
SELECT username,mobileno, count( username) AS count
FROM table
GROUP BY userid, mobileno
HAVING count( username) <=5
ORDER BY count DESC