# Re: transform语法在MS SQL Server上不能用?

Posted by andyLin on October 01, 1999 at 21:43:12:

In Reply to: Re: transform语法在MS SQL Server上不能用? posted by tbman on September 30, 1999 at 23:54:23:

: 就我所知 MS SQL Server不支援transform语法,不过你可以在叙述中加上 case ... when 来达到类似之功能
: ----

: 谢谢你的回答，可否示范个简单的范例，拜托谢谢

假如有一表格(tablea)有产品(pt_no),月份(month)及金额(amt)栏位,若要产生以产品为直向,以月份为横向之报表如下:
select pt_no,sum(case month when '01' amt else 0 end) as amt01,sum(case month when '02' amt else 0 end) as amt02,......... from tablea group by pt_no

Follow Ups: