February 20, 2012 at 1:26 pm
here iam having 5table which has inner joins to each others
TABLE1
QuestionPaperId (PK) QuestionPaper Duration NOOfQuestions MarksPerQuestion MinimumMarks
1 ccna 20 2 5 5
2 net 30 5 10 20
TABLE2
QuestionId (PK) QuestionS QuestionPaperId (FK) choice1 choice2 choice3 correctanswer
1 something ? 1 a b c b
2 something1 ? 1 a b c c
TABLE3
ScheduledExamsId (PK) DateOfExam QuestionPaperId (FK)
1 2012-02-17 1
TABLE4
answerid(pk) ScheduledExamsId (fK) QuestionId (fK) memberid member answer
1 1 1 5 b
2 1 2 5 a
TABLE5 (I NEED TO WIRTE STORE PROCEDURE FOR THIS( TABLE5 )ONLY THE TABLE 5
resultid(pk) ScheduledExamsId (fK) QuestionPaperId (FK) memberid(fk) score percentage
IT SHOULD DISPLAY OUT PUT AS I MENTIONED AFTER THIS TABLE)
resultid(pk) ScheduledExamsId (fK) QuestionPaperId (FK) memberid(fk) score percentage
1 1 1 5 5 50%
I TRIED SAMPLE STOREPROCEDURE
select
a.answerid,
a.MemberAnswerKey ,
SUM(c.MarksPerQuestion) ,
b.AnswerKey
from
dbo.tblAnswer a
inner join
dbo.tblQuestions b
on
b.QuestionId = a.QuestionId
inner join tblQuestionPaper c
on
b.QuestionPaperId = c.QuestionPaperId
group by a.answerid,a.MemberAnswerKey , b.AnswerKey
SO PLEASE ANY SOLVE MY PROBLEM AND GIVE THE CORRECT VIEW STORE PROCEDURE....
February 20, 2012 at 1:51 pm
Please read this article on how to post questions on the forums:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Also, your caps lock is broken.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
February 20, 2012 at 2:18 pm
Sure here is the basic syntax...
Create procedure SomeProc
(
@Variable somedatatype
) as begin
insert SomeTable (Columns)
select Columns from SomeOtherTable
join AnotherTable
end
If you want anything more specific you will have to provide some details as requested above.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply