Starting with an example:
For this data:
NAME Col1 Col2 Col3
row1 0 2 4
row2 1 5 0
row3 1 1 0
Desired query output is:
ColValue CountInCol1 CountInCol2 CountInCol3
0 1 0 2
1 2 1 0
2 0 1 0
4 0 0 1
5 0 1 0
The question explained:
If columns share common values, how can returned rows from a query be condensed on multiple columns? In this example, how can Col1
, Col2
, and Col3
be grouped in to the same ColValue
result?