Skip to content
Advertisement

How to merge rows in sql

I am trying to understand how to merge two rows (which are the same) into one. They both have data that needs to be in the same row but the raw data currently has split them into two rows. Essentially, I need AML business 1 to be on one row with values for 2019:W26 – 2019:W29. Thank you!

enter image description here

Advertisement

Answer

All answer above ar correct, try this one:

SELECT
        Team,
        MAX(2019-W26) AS 2019-W26,
        MAX(2019-W26) AS 2019-W27,
        MAX(2019-W26) AS 2019-W28,
        MAX(2019-W26) AS 2019-W29
    FROM
        table_name
    GROUP BY
    Team;
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement