query user based on profile code example
Example: soql user profile
select user.id, user.Email,user.FirstName,user.LastName,user.profile.name,user.Username,user.IsActive FROM user , user.profile
select user.id, user.Email,user.FirstName,user.LastName,user.profile.name,user.Username,user.IsActive FROM user , user.profile