0
我與Microsoft SQL Server 2014的工作我 有下一個數據格式的表格:SQL,需要改造的表
|customerId | action | amount | isSuccessful | paymentCount |
|____1____ |__ W__ |____10__|____0____ |_____2________|
|____1____ |__ D__ |____20__|____1____ |_____3________|
|____1____ |__ W__ |____30__|____1____ |_____1________|
|____1____ |__ D__ |____40__|____0____ |_____1________|
我需要的是做這種格式報告:
|customerId|depositAmount|withdrawalAmount|depositAttemptCount|withdrawalAttemptCount|
|____1____ |______20 ____|________30_____ |________4_______ _|________3__________ |
如何使用select「轉換」表?
我將不勝感激任何幫助。
看一看這裏: http://stackoverflow.com/questions/15931607/convert-rows-to-columns-using-pivot-in-sql -server – IngoB