Answer the question
In order to leave comments, you need to log in
How to merge rows from a query result that differ in two columns?
Good afternoon. I have a query that returns duplicate rows that differ in two columns, and one of the values is NULL. It's all like this:
NULL 1 NULL 1111 NULL
NULL 1 1111 NULL NULL
NULL 1 1111 1111 NULL
Answer the question
In order to leave comments, you need to log in
As a very stupid solution:
SELECT * FROM ...
WHERE
( column3 != null AND column4 is null) OR ( column3 = null AND column4 != null)
Then store the non-null value from c3 and c4, and then iterate over the selection and replace the empty ones values:D
And then, since you will have a lot of duplicate lines, delete unnecessary
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question