PivotTable

SELECT InvoiceNo,isnull([1],'')+','+isnull([2],'')+','+isnull([3],'')+','+isnull([4],'') ActionType
FROM
(
SELECT InvoiceNo,cast(SendType as varchar) ActionType
from dbo.PrintShareEmail SI with (nolock)
where 1=1
--AND UserID=@userid
AND (@type=0 OR SendType=@type )
) g
PIVOT
(
min(ActionType)
FOR ActionType IN ([1], [2], [3], [4])
) AS PivotTable

posted on 2013-06-08 10:01  远大前程  阅读(131)  评论(0编辑  收藏  举报

导航