select Distinct 'name' as id,(select name from tab where id='001') as '001',
(select name from tab where id='002') as '002',
  (select name from tab where id='003') as '003'
from tab group by id
union all
select Distinct 'age' as id,(select age from tab where id='001') as '001',
(select age from tab where id='002') as '002',
  (select age from tab where id='003') as '003'
from tab group by id
很笨的方法,不过AGE需要字符型的