I have a requirement to take the following general format of data...
Col A Col B Col C Col D A1 B1 C1 D1 A1 B1 C1 D2 A1 B1 C1 D3 A2 B2 C2 D1 A2 B2 C2 D4 A2 B2 C2 D5 A3 B3 C3 D2 A3 B3 C3 D3 A3 B3 C3 D6 A3 B3 C3 D7
And in essence, PIVOT the values on Col D to end up with output that looks similar to...
Col A Col B Col C A1 B1 C1 D1 D2 D3 A2 B2 C2 D1 D4 D5 A3 B3 C3 D2 D3 D6 D7
The values in Col D are in reality a 4 digit code, so potentially many hundreds of values altogether.
The best I have got so far is more like...
Col A Col B Col C D1 D2 D3 D4 D5 D6 D7 A1 B1 C1 2 2 2 A2 B2 C2 2 1 1 A3 B3 C3 2 2 1 1
But given the nature of Col D, the list of D values to the right is not good. The query has (arbitrarily) got a a count as the Aggregate on Col A, hence the numbers showing.
So ...
TRANSFORM COUNT(A & B & C)
Select Distinct A, B,C
FROM TABLE A
GROUP BY A, B, C
PIVOT D
Any assistance would be great.
Thanks.