I have two tables, a header table and a detail table. The data looks like this:
OBJ_NO | Name
12345 | Fred
67891 | Bob
Detail
table:
OBJ_NO | HEADER_OBJ_NO | CODE
1 | 12345 | Red
2 | 12345 | Blue
3 | 12345 | Green
4 | 67891 | Red
5 | 67781 | Green
Essentially what I am after is to see something like this:
OBJ_NO | Name | Red | Blue | Green
12345 | Fred | 1 | 1 | 1
67891 | Bob | 1 | 0 | 1
It could be different number of "Colours" as well. Its not set. And not each Header Ref would have one of each colour as shown in the example above.
How would I achieve this?