0
I need my data to return customer information by courses in a single row, that is, the various different courses done instead of coming in individual rows need to appear in new columns in the respective row to the customer.
I used the command PIVOT Table to sort as needed, but when executing the message appears:
Incorrect syntax next to the keyword 'FOR'.
I’ll synthesize my code:
SELECT [CLIENTE],
[CURSO 1],
[CURSO 2],
[CURSO 3],
[CURSO 4],
[CURSO 5],
[CURSO 6],
[CURSO 7]
FROM (
SELECT DISTINCT
[CLIENTE],
[CURSO],
[CH CURSO CT]
.
.
) AS CLIENTE
PIVOT ([CH CURSO CT] FOR [CURSO] IN
([CURSO 1],
[CURSO 2],
[CURSO 3],
[CURSO 4],
[CURSO 5],
[CURSO 6],
[CURSO 7]))
AS PVT
Who can help me I will be very grateful.