Below query will give you the desired output.
SELECT
PVT.[imtPartID],
PVT.[1] AS Receipt,
PVT.[2] AS Issue,
PVT.[3] AS Adjustment
FROM
(
SELECT
[imtPartID],
imtTransactionType
FROM #PartTransactions
) AS Z
PIVOT (COUNT(imtTransactionType) FOR imtTransactionType IN ([1],[2],[3]))AS PVT
Attachments:
You must be
logged in to view attached files.