Table
COlumnA | ColumnB |
---|---|
KLAX | KONT |
KBUR | KJFK |
KSAN | KBUR |
KJFK | KPHX |
Count distinct columnA
Count distinct columnB
Return a table:
KLAX | 1 | 0 |
KBUR | 1 | 1 |
KSAN | 1 | 0 |
KJFK | 1 | 1 |
KONT | 0 | 1 |
KPHX | 0 | 1 |
I don’t think this can be done with 1 Select
I even tried temp tables. I just can not wrap my head around this one.
Any ideas?
2
Answers
It appears that you want to report for distinct counts of the labels across both columns, in a single column. If so, then we can try the following union approach:
See it work here: