April 28, 2010 at 1:29 pm
I really need help not sure if it requires an UNPIVOT which I'm trying to figure out how to write that one in a query or some other method.
I don't have any code for an example but I do have sample data to try and show what it is I'm doing in SQL.
Original Data Layout header Example:
client_name | brand_name | client_id | brand_id
This is the data I'm working with and below the example is how I want to lay it out.
UNPIVOT or whatever way it takes in SQL, Example:
client_name | client_id | brand_id | brand_name1 | brand_name2 | brand_name3
I only listed the headers for the columns
Someone please help I'm pulling my hair out on this, thanks to all who can help.
April 28, 2010 at 1:51 pm
If you have a fixed number of brand_names then you could either use PIVOT (see BOL, aka BooksOnLine, the SQL Server help system), or CrossTab (see the related link in my signature). If the number of brand_names can vyry, you should look into the DynamicCrossTab link.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply