Hi, I have very limited SQL experience but need to urgently need some assistance to achieve the following:
I have data in a table as shown in the example below. Each record has a variable number of attributes with unique contents. Each separate Attribute for a record is stored in a new row.
Record | Attribute | Contents
123 | Attr1 | Cont1
123 | Attr2 | Cont2
123 | Attr3 | Cont3
124 | Attr1 | Cont4
124 | Attr2 | Cont5
125 | Attr1 | Cont6
126 | Attr4 | Cont7
126 | Attr5 | Cont8
I would like to read the data into a new table, but converting the Attributes to columns, effectively creating 1 row for each Record. Example below.
Record | Attr1 | Attr2 | Attr3 | Attr4 | Attr5
123 | Cont1 | Cont2 | Cont3 | NULL | NULL
124 | Cont4 | Cont5 | NULL | NULL | NULL
125 | NULL | NULL | NULL | Cont7 | NULL
126 | NULL | NULL | NULL | NULL | Cont8
Any assistance with the syntax would be greatly appreciated!
Gordon.