I’ve googled for a while but haven’t found an aswer so I request your help.
I have a subquery which returns me these values:
id | item1 | item2 | item3 ---|-------|-------|------ 1 | 123 | Null | Null 1 | Null | 213 | Null 1 | Null | Null | 321
And I need to make it look like this:
id | item1 | item2 | item3 ---|-------|-------|------ 1 | 123 | 213 | 321
Advertisement
Answer
SELECT id,max(item1) AS item1,max(item2) AS item2,max(item3) AS item3 FROM tab GROUP BY id