P
P
protsey2018-08-14 20:16:07
Database
protsey, 2018-08-14 20:16:07

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

Is it possible to perform some transformation on the third and fourth columns in this query to get a construction of this kind?
NULL 1 1111 1111 NULL
Thanks in advance for the tip.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin, 2018-08-14
@nicebmw9

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 question

Ask a Question

731 491 924 answers to any question