I am struggling to see how to do what i expect is a simple pivot. Although this is different to all the examples of pivot that I have seen.
Dummy structure as follows:
I have a attributes stored against a specific Source ID as follows:
Attribute Table
SrcId Size Color
123 Small Green
456 Medium Yellow
789 Large Red
I now have data for these Source Id's that looks like this
Data Table
Id SrcId Amount
1 123 1000
2 123 2000
3 123 3000
4 123 4000
5 456 1000
6 456 5000
7 456 7000
8 789 2000
9 789 3000
I know that data doesnt make much sense and what I am trying to do doesnt seem very useful but this is what we need to do. We need to do list all the source attributes and transpose the data alongside the attributes in columns, as follows:
Results View
SrcId Size Color Amount1 Amount2 Amount3
123 Small Green 1000 2000 3000
456 Medium Yellow 1000 5000 7000
789 Large Red 2000 3000 NULL
Note how for SrcId 123 the additional Amount of 4000 was left out because we are only retrieving 3 columns worth of data for each source.
Any ideas please advise. Thanks