This may be more of a design issue than anything, but I\'m hoping it\'s possible without too much voodoo.
Suppose I have a table like this:
SELECT * FROM
You're doing the wrong thing first, and attempting to fix it up afterwards. That's not going to work.
The things you want to join are select * from stuff where grp = 'a'
and select * from stuff where grp = 'b'
. So join those:
select a.ID as a, b.ID as b from
(select * from stuff where grp = 'a') a
full join
(select * from stuff where grp = 'b') b
on b.id = a.id
SQL Fiddle