I have this Select statement
select Id, UserName, from UserTable where Department= @DepartmentInput
and a variable to calculate how many users from the department
@UserCounter
Is there a way to add count(the number of users from the department) into @UserCounter from the select statement should the statement runs in a while loop?