title: Simplify/reuse subqueries in this SQL query
body: <p>I have the following SQL query:</p>
  
  <pre><code>SELECT "users".* FROM "users"
  WHERE (
    users.id IN (SELECT manager_id FROM managerships WHERE managerships.employee_id = 1234) OR
    users.custom_id IN (SELECT manager_custom_id FROM managerships WHERE managerships.employee_id = 1234) OR
    users.saml_id IN (SELECT manager_saml_id FROM managerships WHERE managerships.employee_id = 1234) OR
    users.email IN (SELECT manager_email FROM managerships WHERE managerships.employee_id = 1234)
  )
  </code></pre>
  
  <p>Now I believe there should be a way to just select once from my <code>managerships</code> table and reuse it, something like:</p>
  
  <pre><code>SELECT manager_id, manager_email, manager_custom_id, manager_saml_id FROM managerships WHERE managerships.employee_id = 1234
  </code></pre>
  
  <p>How can I achieve that? Thank you!</p>