Forum Discussion

bjackson's avatar
bjackson
Regular Visitor
3 years ago
Solved

Pivot after unpivot not working

Hi there! I have a source table that looks like this:    Source Table:  Contact Name Address 1 - City Address 1 - Country Address 2 - City Address 2 - Country John Antofagasta Chile B...
  • HotChilli's avatar
    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)