Hi All this new thread is in connection with my earlier thread http://scn.sap.com/thread/3881937 .I am trying to check if what ever Augusto has suggested would work for me.
But i am getting this error can you please let me know what could be going wrong.
Here is the Error
1). [SAP AG][LIBODBCHDB32 DLL][HDBODBC32] Syntax error or access violation;257 sql syntax error: incorrect syntax near "[": line 2 '' (SWEI)
This is the query i am trying
SELECT P."Code", P."CName",
[1] as 'Jan',
[2] as 'Feb',
[3] as 'Mar',
[4] as 'Apr',
[5] as 'May',
[6] as 'Jun',
[7] as 'Jul',
[8] as 'Aug',
[9] as 'Sep',
[10] as 'Oct',
[11] as 'Nov',
[12] as 'Dec'
FROM
(SELECT T0."ItemCode" as Code, T0."Dscription" as CName, T0."Quantity" as Qty,
MONTH(T0."DocDate") as month
FROM inv1 T0 Inner Join OINV T1 ON T0."DocEntry" = T1."DocEntry"
WHERE Year(T1."DocDate") = 2015
UNION
SELECT (T0."ItemCode") as Code, T0."Dscription" as CName, -1 * T0."Quantity" as Qty,
MONTH(T0."DocDate") as month
FROM RIN1 T0 Inner Join ORIN T1 ON T0."DocEntry" = T1."DocEntry"
WHERE Year(T1."DocDate") = 2015) S
PIVOT (SUM(Qty) FOR month IN
([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12])) P
Thanks for all the help,
Anjana