--If the name column can be sorted
select id,name,'' as name2 from table1
union
select idmc,name2,name3 from table2
order by name
--If it cannot be sorted
select id,name,name2 from
(
select id,name,'' as name2,0 as sort from table1
union
select idmc,name2,name3,1 from table2
)tt
order by id,sort |