请问在SQL2005下可以查询,SQL2000下要实现这个效果语句要怎么写呢?
select * from (select clientid,nf=datepart(yy,billdate),yf=datepart(mm,billdate),je=sum(totalamt) from invoice GROUP BY clientid,datepart(yy,billdate),datepart(mm,billdate)) as #tt
PIVOT(sum(je) FOR yf IN([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12])) AS PVT