title: Bitwise operation in Group By
body: <p>I must use bitwise operations in a <code>group by</code> query but I didn't found anything.</p>
  <p>Table:</p>
  <pre><code>PermissionId, BitMask(BigInt)
  1,            4
  2,            7
  1,            8
  1,            5
  </code></pre>
  <p>I want results as:</p>
  <pre><code>1,           13
  2,           7
  </code></pre>
  <p>How can I write this script in T-SQL as below</p>
  <pre><code>SELECT PermissionId, BIT_OR(BitMask)
  FROM table
  GROUP BY PermissionId
  </code></pre>