thegladiator Posted February 19, 2014 Share Posted February 19, 2014 I have an excel spreadsheet that I can enter into a table and manipulate far faster in MySQL. The issue is that the rows are Duplicated. The structure is shown below. Part Number | Description | Qty | Cost | OEM Resale ABC | Switch | 1 | 1.00 | 3.5 ABC | Switch |25 | 1.00 | 2.75 Desired Result Part Number | Description | Qty1 | Cost1 | OEM Resale1 | Qty2 | Cost2| Resale2 I would like to have them in separate columns. I'm using phpmyadmin to write my querys. Is this at all possible? The best i've seen is the concat function which once i get past description would put all remaining data into one field that has been comma separated. I could do that and transfer back to excel. I ask as the file that I'm using is 30K+ rows and the coworker i'm setting this up for gets this file in the same format to evaluate about 5 times a year thanks c Quote Link to comment https://forums.phpfreaks.com/topic/286322-mysql-duplicate-rows/ Share on other sites More sharing options...
gristoi Posted February 20, 2014 Share Posted February 20, 2014 databases are relational, so use them. You have duplication that you need to normalise. Part number and descirption could be moved into a parts table. then you could have an orders table. so would look like: // parts table id | part_number | part_description 1 ABC Switch //orders table: id | part_id | Qty | Cost | OEM_Resale 1 1 1 1.00 3.5 2 1 25 1.00 2.75 Quote Link to comment https://forums.phpfreaks.com/topic/286322-mysql-duplicate-rows/#findComment-1469642 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.