我的基本查询
ID Days Y Type
3014 L;M;M;J;V;S;D 15 PDC
3014 L;M;M;J;V;S;D 16 PDC
3014 NULL 17 PDC
3014 NULL 18 PDC
3014 NULL 19 PDC
3014 NULL 20 Altern
3014 NULL 21 Altern
我想要达到的目标
3014 L;M;M;J;V;S;D L;M;M;J;V;S;D NULL NULL NULL NULL 15 16 17
我的 Sql
select * from (select
FS.FieldStudyId,
C.Day as Dayss,
C.IDCourse,
C.Type
from
FieldStudy FS,
Course C
where
Fs.FieldStudyId = C.FieldStudyId)d
pivot
(
max(Dayss)
for FieldStudyId in (select z.FieldStudyId from FieldStudy z)
)x;
但我不工作
Msg 156, Level 15, State 1, Line 14 Incorrect syntax near the keyword 'select'.
Msg 102, Level 15, State 1, Line 14 Incorrect syntax near ')'