Click here to Skip to main content
15,896,450 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
sir i have 100 student .. every student have 8 subject in every year..the student study 4 year .. so how i find one single student over all total mark... this same process in 100 student... please tell me sir.........
Posted

1 solution

There is a strong smell of homework here, so you will get no code!
How you do this will depend on your database design: you could do this with a single row in a single table:
StudentInfo, year1Data, year2Data, year3Data, year4Data
where each yearNData consisted of 8 subject marks.
Then the query is pretty simple: just use the SQL SUM function to add all the subject marks together.
That is a clumsy way to do it though: You would probably be better off with a Student table, a Year Table which refers to the student ID, and a Marks Table which refers to the year table. That makes teh query more complex, but provides more flexibility.

Or you could do it somewhere in the middle.

What kind of scheme do you have?
 
Share this answer
 
Comments
Richard MacCutchan 18-Oct-11 6:13am    
What kind of scheme do you have?
Probably the plz send codz scheme. :)
OriginalGriff 18-Oct-11 6:16am    
Cynic! :laugh:
Richard MacCutchan 18-Oct-11 6:19am    
Realist!
OriginalGriff 18-Oct-11 6:47am    
That makes the two of us then.

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