本文介绍了哪个方法用于在sql server中进行以下查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,

A)标记详情表包含以下栏目

1.markid,2.Examid,3.subjectid,4.admissionnumber,5.markobtained, 6.classid 7.mark



B)Subject_registration包含

1.subjectid 2.subjectname等



C)class_details包含

1.classid,2.classname等



D)studentAdmission_table包含

1.admissionnumber,2.studentname等



E)Rollnumber_details包含

1.admissionnumber 2。 rollnumber等



来自mark_details我想选择数据



AdmissionNumber Rollnumber Name subject1 subject2 subject3



特定班级。



哪种方法对于获得答案很有用。在这种情况下基于class subjectName和no.of subject coul d改变。我对此很新。请帮助





OP的评论

对不起我的问题输错了。

例如

mark _details table contains

Hi friends,
A) mark details table contain following column
1.markid, 2.Examid,3.subjectid,4.admissionnumber,5.markobtained,6.classid 7.mark

B) Subject_registration contain
1.subjectid 2.subjectname and etc.

C) class_details contain
1.classid,2.classname and etc

D) studentAdmission_table contains
1.admissionnumber,2.studentname and etc

E) Rollnumber_details contain
1.admissionnumber 2.rollnumber and etc.

from mark_details I want to select data as

AdmissionNumber Rollnumber Name subject1 subject2 subject3

for particular class.

which method is useful for getting answer.In this cases based on the class subjectName and no.of subject could be changed. I am very new to this. please help
me

Comments from OP
sorry my question is wrong typed.
for example
mark _details table contain

markid  examid subjectid  admissionumber  mark  classid
 1       2        23011      100            89   12
 2       2        23012      100            87   12
 3       2        23013      100            77   12
 4       2        23011      101            98   12
 5       2        23012      101            78   12
 6       2        23013      101            78   12





我想要这样的



I want like this

Rollnumber   admissionumber  name  subject1(23011)  subject(23012) subject(23013)
1001              100        XXXX    89                87               77





for classid 12.



是否为此预期结果的枢轴运算符?如果所有类别的主题相同意味着我们可以使用枢轴。但是这里怎么解决这个?



[/编辑]



谢谢你



for classid 12.

Is pivot operator for this desired result? if the no of subjects for all class same mean we can use pivot. but here how can solve this?

[/Edit]

Thank you

推荐答案


这篇关于哪个方法用于在sql server中进行以下查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 22:55