Given the following sample table:
col_A col_B col_C
123 RED 4
234 BLUE 2
123 RED 7
345 GREEN 1
123 BLUE 5
456 RED 6
234 BLUE 3
I would like to generate the code to return:
col_A col_B col_C col_D
345 GREEN 1 1
234 BLUE 2 2
123 RED 2 4
123 BLUE 1 5
456 RED 1 6
where col_C is the count of DISTINCT(col_A+col_B) and col_D is ordered on the value of the first occurrance. I am having trouble with the DISTINCT requirement as well as the first VALUE.
col_A col_B col_C
123 RED 4
234 BLUE 2
123 RED 7
345 GREEN 1
123 BLUE 5
456 RED 6
234 BLUE 3
I would like to generate the code to return:
col_A col_B col_C col_D
345 GREEN 1 1
234 BLUE 2 2
123 RED 2 4
123 BLUE 1 5
456 RED 1 6
where col_C is the count of DISTINCT(col_A+col_B) and col_D is ordered on the value of the first occurrance. I am having trouble with the DISTINCT requirement as well as the first VALUE.