Your going to have to give a lot more information about what your desired output is. You are probably not seeing what you want as you've got a HAVING clause in your query. Otherwise your query looks like it is probably correct.
See example schema/data below
DECLARE @Users TABLE (
Id INT NULL,
Username VARCHAR(200) NULL
);
DECLARE @Query TABLE (
UserId INT NULL,
Query VARCHAR(200) NULL
);
INSERT INTO @Users (Id,Username) VALUES (1,'user1')
INSERT INTO @Users (Id,Username) VALUES (2,'user2')
INSERT INTO @Query (UserId, Query) VALUES (1, 'A');
INSERT INTO @Query (UserId, Query) VALUES (2, 'A');
INSERT INTO @Query (UserId, Query) VALUES (2, 'A');
INSERT INTO @Query (UserId, Query) VALUES (2, 'A');
INSERT INTO @Query (UserId, Query) VALUES (2, 'A');
SELECT
A.Username,
COUNT(*)
FROM @Users AS A
JOIN @Query AS B ON B.UserId = A.Id
GROUP BY A.Username
ORDER BY A.Username
Then the output of this is
Username ItemsAnswered
user1 1
user2 4
Which is ordered by the username