摘要:
一般我们在使用SQL语句实现行列转置时候,最常用的方法无外乎就是 case语句来实现,但是如果需要需要转置的列太多,那么case起来语句就无限庞大,十分不方便,sql server中的PIVOT就可以帮助我们解决此类问题PIVOT語法,如下: SELECT , [first pivoted column] AS , [second pivoted column] AS , ... [last pivoted column] AS FROM () AS PIVOT ( () FOR [] ... 阅读全文