I have a dataset that looks like this

| Position | Value |
| --- | --- |
| 1 | 1 |
| 1 | 2 |
| 1 | 3 |
| 2 | 8 |
| 3 | 5 |
| 3 | 6 |

And I'd like to generate all combinations of strings with the value at each position.

For this example, the output would look like

| Output |
| --- |
| 185 |
| 285 |
| 385 |
| 186 |
| 286 |
| 386 |

The order doesn't particularly matter.

**Note**: There can be an arbitrary amount of groups and values per group.

The below SQL sets up the sample input.

```
Declare @Table Table 
(
    groupId int, 
    value int
)

Insert Into @Table 
    Select 1,1
    union select 1,2
    union select 1,3
    union select 2,8
    union select 3,5
    union select 3,6

Select 
        * 
    From 
        @Table

```