如何把表1的數(shù)據(jù)換成表2的形式
select max(a.num) A,max(b.num) B,max(c.num) C,tttt.name from tttt
left join (select * from tttt where abc='C') c on c.abc=tttt.abc and c.name=tttt.name
left join (select * from tttt where abc='B') b on b.abc=tttt.abc and b.name=tttt.name
left join (select * from tttt where abc='A') a on a.abc=tttt.abc and a.name=tttt.name
group by name
posted on 2008-07-16 11:18 lqx 閱讀(116) 評論(0) 編輯 收藏 所屬分類: database