Question: I have the following DataSet on a SSRS report:

```
SELECT
  VariationCode.Code
  ,VariationCoding.Comment
  ,VariationCoding.SubmissionDate
  ,VariationCoding.Id
FROM
  VariationCode
  INNER JOIN VariationCoding
    ON VariationCode.Id = VariationCoding.VariationCodeId
WHERE VariationId = @VariationId

```

I am showing static headers on the left and data on the right which works fine but I'm struggling to group the results by ID and show them as a separate table per grouping.

Grouping the row by parent using VariationCoding.Id shows one table with no grouping at all. I suspect having the headers on the left is the problem since most solutions I've seen have the headers on top.

How can I show static headers on the left and group the results by VariationCoding.Id in such a way that each result will be displayed in a separate table?

Answer: 
n bits can represent 2n different values. (The first bit can have two values \* the second bit can have two values \* the third bit can have two values \* ...)

For example, 3 bits can form 23 = 8 different bit patterns, and thus up to 8 different values.

```
000
001
010
011
100
101
110
111

```

If each bit pattern represents an integer, then an n-bit integer can represent 2n different integers. For example,

* It could represent the integers from 0 to 2n-1 inclusively  
(because (2n-1) - (0) + 1 = 2n different values).

For example,

```
  000   0
  001   1
  010   2
  011   3
  100   4
  101   5
  110   6
  111   7

```
* It could represent the integers from -(2n-1) to 2n-1-1 inclusively  
(because (2n-1-1) - (-(2n-1)) + 1 = 2n different values).

For example,

```
  100  -4
  101  -3
  110  -2
  111  -1
  000   0
  001   1
  010   2
  011   3

```

You could assign any meaning to these values, but the previously stated ranges are the ones understood by twos'-complement machines for unsigned integers and signed integers respectively.[1]

---

1. On a [ones'-complement](https://en.wikipedia.org/wiki/Ones%27_complement) machine, there are two ways of writing zero (0000...00002 and 1000...00002), so the range is only -(2n-1-1) to 2n-1-1. I think all modern machines are [twos'-complement](https://en.wikipedia.org/wiki/Two%27s_complement) machines, though.
Adding to @Yunnosch's excellent explanation on unsigned numbers, almost all modern computers use "two's complement" to represent signed binary integers.
In two's complement, the most significant bit is used as the "sign bit" and bits are the complement of absolute value of the number + 1. So for the 3 bit example, while the range for unsigned values is 0 to 7, the range for signed values is -4 to 3:

```
100 : -4
101 : -3
110 : -2
111 : -1
000 :  0
001 :  1
010 :  2
011 :  3

```

Notice that for signed numbers the range of negative numbers is one greater than the range of positive numbers. That's because, while in number theory, `0` is neither positive or negative, in binary representation, `0` has to be either negative or positive. Because it has the most significant bit cleared, `0` is part of the positive number domain, so that leaves one less positive number available.