• I have removed the "big spaces" and PF5 the sql qry but still get the Incorrect syntax near 'PIVOT' error - do you think it could be my SQL thats messing around or am I missing something in the below sql code - thanks

    DECLARE @demo

    TABLE (

    group_id INTEGER NOT NULL,

    value MONEY NOT NULL

    );

    INSERT @demo (group_id, value) VALUES (1, $1.00);

    INSERT @demo (group_id, value) VALUES (1, $2.00);

    INSERT @demo (group_id, value) VALUES (1, $3.00);

    INSERT @demo (group_id, value) VALUES (1, $4.00);

    INSERT @demo (group_id, value) VALUES (2, $5.00);

    INSERT @demo (group_id, value) VALUES (2, $4.00);

    INSERT @demo (group_id, value) VALUES (3, $3.00);

    INSERT @demo (group_id, value) VALUES (3, $2.00);

    INSERT @demo (group_id, value) VALUES (3, $7.00);

    INSERT @demo (group_id, value) VALUES (4, $2.00);

    SELECT group_id,

    value

    FROM @demo;

    SELECT P.[1], P.[2], P.[3], P.[4]

    FROM @demo D PIVOT(SUM(D.value) FOR D.group_id IN ([1], [2], [3], [4])) P;