我的下面的代码中有什么问题 [英] what is the problem in my following code
问题描述
嗨朋友
以下是我的数据透视表代码。
Hi friends
following is my code for pivot table.
select * from
(select
sb.AdmissionNumber,
sa.RollNumber,
sc.Name,
sr.SubjectName,
sa.InternalMark,
sa.ExternalMark
from
schoolcampus.dbo.Mark_details sa
inner join
schoolcampus.dbo.StudentRollnumber_details sb on
sa.RollNumber = sb.RollNumber
inner join
StudentAdmission_details sc on
sc.AdmissionNumber = sb.AdmissionNumber
inner join
SubjectRegistration_details sr on
sr.SubjectCode = sa.SubjectCode
) p
PIVOT ( Max(InternalMark) for
SubjectName IN
( [English],
[Maths],
[Science],
[Social Science],
[Tamil]
)
) AS pvt
PIVOT ( Max(ExternalMark) for
SubjectName IN
( [English],
[Maths],
[Science],
[Social Science],
[Tamil]
)
) AS pvt1
和错误是t
消息207,等级16,状态1,行1
无效的列名称'SubjectName'。
消息265,级别16,状态1,行1
PIVOT运算符中指定的列名English与PIVOT参数中的现有列名冲突。
消息265,级别16,状态1,行1
PIVOT运算符中指定的列名Maths与PIVOT参数中的现有列名冲突。
消息265,级别16,状态1,行1
PIVOT运算符中指定的列名Science与PIVOT参数中的现有列名冲突。
Msg 265,Level 16,State 1,Line 1
PIVOT运算符中指定的列名Social Science与PIVOT参数中的现有列名冲突。
Msg 265,Level 16,State 1,Line 1
colu在PIVOT运算符中指定的名称Tamil与PIVOT参数中的现有列名称冲突。
消息8156,级别16,状态1,行1
列'pvt1'多次指定'英语'。
and the error is t
Msg 207, Level 16, State 1, Line 1
Invalid column name 'SubjectName'.
Msg 265, Level 16, State 1, Line 1
The column name "English" specified in the PIVOT operator conflicts with the existing column name in the PIVOT argument.
Msg 265, Level 16, State 1, Line 1
The column name "Maths" specified in the PIVOT operator conflicts with the existing column name in the PIVOT argument.
Msg 265, Level 16, State 1, Line 1
The column name "Science" specified in the PIVOT operator conflicts with the existing column name in the PIVOT argument.
Msg 265, Level 16, State 1, Line 1
The column name "Social Science" specified in the PIVOT operator conflicts with the existing column name in the PIVOT argument.
Msg 265, Level 16, State 1, Line 1
The column name "Tamil" specified in the PIVOT operator conflicts with the existing column name in the PIVOT argument.
Msg 8156, Level 16, State 1, Line 1
The column 'English' was specified multiple times for 'pvt1'.
推荐答案
您询问问题并且您已经发布了问题,请阅读您的错误消息,他们会明确告知您有关问题的信息。
You ask about problems and you already posted your problems please read your error messages they are clearly informing you about problems.
这篇关于我的下面的代码中有什么问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!