question

snlrjn avatar image
snlrjn asked

I don't know why I am getting Incorrect syntax error on PIVOT?

SELECT * FROM ( SELECT YEAR(TRF.TrfReceiptDate)as [year], LEFT(datename(month,TrfReceiptDate),3)as [month],COUNT(TRF.TrfID) as Total FROM dbo.TRF TRF WHERE TRF.TrfTestTypeRMID IN(23,304,475)AND YEAR(TRF.TrfReceiptDate)= '2016' GROUP BY TRF.TrfReceiptDate ) as s PIVOT ( SUM(Total) FOR [month] IN (Jan,Feb,Mar,Apr) )as pvt
sql querypivotsyntax
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ThomasRushton avatar image ThomasRushton ♦♦ commented ·
What's the error you're getting?
0 Likes 0 ·

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.