Click here to Skip to main content
15,908,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have table answer with colums as answer_id,question_id,student_id,stu_ans,stu_marks.
i want add all marks of particular student
and store in result table
in Result table colums are result_id,student_id,marks.
i will store added marks result table but I don't how to perform addition of marks of particular student and store in integer variable

example i want perform addition of marks where student_id=1
Posted
Comments
ZurdoDev 20-Mar-14 13:37pm    
So, where are you stuck? Do you just want the count? Then use COUNT(*) ... Where student_id = 1. Or use SUM(). I am not sure where you are stuck.
nandakishoreroyal 21-Mar-14 1:57am    
you store it another table
totalresultsperStudent
swati gapat 21-Mar-14 10:53am    
i want insert in total marks in result tabel...
result tabel contains result_id,student_id,tatal_marks
submit your reply
nandakishoreroyal 21-Mar-14 2:06am    
IN which table you have to insert the total marks

1 solution

SQL
INSERT INTO RESULTS(total)VAlues( select SUM(Marks) from Results Where Student_Id=1)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900