Is anybody to know how to get result in this example in T-SQL:

```
id val1 val2
1.  a   b
1.  c   d
1.  b   a
1.  d   c
1.  e   f
2.  k   m
2.  m   p
2.  m   k 
```

```
id val1 val2
1.  a   b
1.  c   d
1.  e   f
2.  k   m
2.  m   p
```

a b and b a group only in a b. The same for c d (d c) and k m (m k)