如果是SQL SERVER 2005的话很简单用PIVT就可以了。
如果SQL Server 2000的话是有点复杂,但也不难。
selectmax(cas when col1 = a1 then b1 else null end) as a1,
max(cas when col1 = a2 then b2 else null end) asa2
....
max(cas when col1 = an then bn else null end) an
from tablename
同样的方法对c也做这个操作一下,再UNION ALL就好了。