Forum Discussion
Pivot after unpivot not working
- 3 years ago
You would need to keep the (1,2 ) details for the last step to work correctly.
It is possible but I would probably advise a simpler approach:
Duplicate the original table.
In one query remove the (2) columns.
In the other remove the (1) columns.
Edit the column names to be the same in both queries.
Append the queries.
--
If it is important to hold on to the 1,2 details then add a column in each query that identifies the AddressNo (hardcode it to 1 or 2 for the appropriate table)
You would need to keep the (1,2 ) details for the last step to work correctly.
It is possible but I would probably advise a simpler approach:
Duplicate the original table.
In one query remove the (2) columns.
In the other remove the (1) columns.
Edit the column names to be the same in both queries.
Append the queries.
--
If it is important to hold on to the 1,2 details then add a column in each query that identifies the AddressNo (hardcode it to 1 or 2 for the appropriate table)
- bjackson3 years agoRegular Visitor
I splitted the column Attribute by delimiter equals to "-" resulting in two columns: Column "Attribute.1" with values "Address 1" and "Address 2" and column "Attribute.2" with values "City" and "String".
After doing some string transformation on the "Attribute.1" column to keep just the number (1 and 2) and then renamining the column to "Address #", I was finally able to pivot the column "Attribute.2" and get the desired table. Thanks for your help!