I want to combine distinct column of an one table, I want a column wise distinct.

SELECT  ALT_SRC_HOST FROM ATABLE WHERE ALT_SRC_HOST IS NOT null
UNION 
SELECT SOURCE_IP AS SOURCE_IP FROM ATABLE WHERE SOURCE_IP IS NOT null

output is coming, in one column. I want the output is in two column expected output

ALT_SRC_HOST    SOURCE_IP
-               10.262.737.21
                1.34.34.112

1 Answers

0
MichaelTiefenbacher On Best Solutions

Not sure why you want it in a single SQL but this is an option

select distinct ALT_SRC_HOST as col1 , NULL as col2
from ATABLE
union all
select distinct NULL as col1 , SOURCE_IP as col2
from ATABLE