Need help in clubbing of rows with union all

Suppose i have the following query
select 'a' as a, '' as b
union all
select '' as a, 'b' as b
The result set is :-
a ' '
' ', b

Now, i need a query that returns a single row with a result set like :-
a b

select 'a' as a, 'b' as b

This query is conform with what you asked, but I don't think it's what you're after.
Can you rephrase your question?

1 Like
SELECT MAX(a) AS a, MAX(b) AS b
FROM (
    select 'a' as a, '' as b
    union all
    select '' as a, 'b' as b
) AS table1
2 Likes