title: Is current row value in other column?
body: <p>Im trying to determine if a user is a manager by determining if their Id <code>userProfiles.UserProfilesId</code> is anywhere in the field <code>UserProfiles.ManagerId</code>. My current sql statment says id is not valid. Is there any subquery I could create to determine this information?</p>
  
  <pre><code>SELECT
        IsNull(PersonalTimeRemaining, 0) as PTO,
        UserProfiles.UserProfileId as id,
        us.Email,
        us.LastName + ', ' + us.FirstName,
        managers.Email as 'manager',
        case when PersonalTimeRemaining is null then 'hourly' else 'salary' end as salaryType,
        case when 
          EXISTS(SELECT * from UserProfiles where id = UserProfiles.UserProfileId)
        then 'User' else 'Manager' end as salaryType
    FROM UserProfiles
    inner join Users as us on us.UserId = UserProfiles.UserProfileId
    inner join Users as managers on managers.UserId = UserProfiles.ManagerId
  </code></pre>