You don't say what database. You also don't say if you have a primary key or which columns match between row A and row B. It makes it hard to come up with an exact solution. Here is a solution (not completely tested) that works in SQL server assuming that you can detect paired rows by columns 2, 3, and 5 matching and that column 1 is your primary key. If this is not the case, your only option may be "diddling with the client side".
with t1 as
(
select a.column1 as acol1, b.column1 as bcol1, a.column2, a.column3, a.column4 as acol4, b.column4 as bcol4, a.column5
from tab a inner join tab b on a.column2 = b.column2 and a.column3 = b.column3 and a.column5 = b.column5 and a.column1 < b.column1
)
--Return Row A if B is null no matter what A is.
select acol1, column2, column3, acol4, column5
from t1
where bcol4 is null
UNION ALL
--Add Row B when A is null
select bcol1, column2, column3, bcol4, column5
from t1
where acol4 is null and bcol4 is null
UNION ALL
--Add all row B's with a value
select bcol1, column2, column3, bcol4, column5
from t1
where bcol4 is not null