I have a table with the following data:
subitem, subitempart, subitemvalue
'Badge", 'Issued to', 'abc'
'Badge', 'Located at', 'bcd'
'Badge, 'signed for', 'def'
'key', 'number', '123'
'key', 'Issued to', 'abc'
The subitempart names are from a separate table with two fields: [code] and [description]. A subitem can have 1 to 20 subitemparts, it varies per item.
My client wants to see this as followed:
[Subitem], [Issued to], [Located at], [Signed for], [Number]
'Badge' , 'abc' , 'bcd' , 'def' , NULL
'key' , 'abc' , NULL , NULL , '123'
So what I want to do, is put all subitemparts available to columns, then put the values in the right fields and then remove the columns that are empty on each row.
Is this possible in MS SQL and if yes, how?
thanks in advance for any help.
rg. Eric