Can anyone tell me error in this query
SELECT TxnAttributesID,TxnAttributesName,AccountabilityTypeID,TxnAttributesValue,[DAY],[GRAVE],[SWING],
CreatedDate,ModifiedDate
FROM ( SELECT t1.TxnAttributesID,t1.TxnAttributesName,t1.AccountabilityTypeID,t2.TxnAttributesValue,t3.ShiftTypeID,
t3.ShiftTypeName,t2.CreatedDate,t2.ModifiedDate
from Code.tblTxnAttributes as t1 inner join
App.tblDailyRevDetail as t2 on t1.TxnAttributesID = t2.TxnAttributesID
inner join App.tblShiftType as t3 on t2.ShiftTypeID = t3.ShiftTypeID) as P
PIVOT (SUM(cast(TxnAttributesValue as int)) FOR ShiftTypeName IN ([DAY],[GRAVE],[SWING])) AS pvt
ORDER BY CreatedDate
Its giving Msg 102, Level 15, State 1, Line 9
Incorrect syntax near '('.
but i have checked and all are closed properly