MySQL - Query to merge rows in table with duplicate values in on field

merge, mysql

Solution

Insert into newtable 
    select ID,Nbr,max(Data1),max(Data2),max(Data3) from table group by Nbr

Try this and let me know it worked or not

Problem

I'm quite new on data bases and would be very grateful for some help, I have a database on the following format: ``` ID Nbr Data1 Data2 Data3 1 1 a 2 1 b 3 1 c 4 2 d 5 2 e 6 2 f ``` And would like to have a way to extract, with a MySQL query, the data on the following format: ``` Nbr Data1 Data2 Data3 1 a b c 2 d e f ``` I know that is not best practice to have the data on a non normalized format but sadly I can't change the source data. Grateful for your help!

Original source