Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/286322-mysql-duplicate-rows/
Share on other sites

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.