Hello all, I am looking for some guidance on how to handle a (SQL) query that is causing duplicate rows due to one column's values. In the example below, the data from the "Name," "Age" and "City" columns is stored in a main source while the date for "Fruit" and "Quantity" are being pulled from a separate source and is not stored properly in the main source, causing extra rows with mostly duplicate data when the query combines these fields. As you can see from the tables below, I am looking to take the three distinct values from the "Fruit" column and have each be their own columns using the values of the "Quantity" column, thus making the table much easier to read.
Ideally, I would look into the source or SQL code to take care of this but, as a user, my organization limits my access at this level so I am looking at how to handle this when exporting the information to Excel. What is this problem/technique called and what are some strategies to work around it? I have tried several subtle changes when searching this issue but all the solutions deal with deleting duplicate rows, which is what I want to do, but also transform part of the table. Is there a built-in capability in Excel that already deals with this that I am ignorant about?
Ideally, I would look into the source or SQL code to take care of this but, as a user, my organization limits my access at this level so I am looking at how to handle this when exporting the information to Excel. What is this problem/technique called and what are some strategies to work around it? I have tried several subtle changes when searching this issue but all the solutions deal with deleting duplicate rows, which is what I want to do, but also transform part of the table. Is there a built-in capability in Excel that already deals with this that I am ignorant about?
Name | Age | City | Fruit | Quantity |
Tom | 20 | Belfast | Cherry | 6 |
Tom | 20 | Belfast | Grape | 1 |
Tom | 20 | Belfast | Honeydew | 4 |
Harry | 31 | Edinburgh | Cherry | 8 |
Harry | 31 | Edinburgh | Grape | 0 |
Harry | 31 | Edinburgh | Honeydew | 2 |
Mary | 29 | Dublin | Cherry | 3 |
Mary | 29 | Dublin | Grape | 8 |
Mary | 29 | Dublin | Honeydew | 1 |
Name | Age | City | Cherry | Grape | Honeydew |
Tom | 20 | Belfast | 6 | 1 | 4 |
Harry | 31 | Edinburgh | 8 | 0 | 2 |
Mary | 29 | Dublin | 3 | 8 | 1 |