Thursday, 15 January 2015

mysql - How to retrieve my DB data using groupby for storing it into my C# Struct? -



mysql - How to retrieve my DB data using groupby for storing it into my C# Struct? -

i have 1 db table named final_mark , contains pupil test marks in question wise.this table structure.

and c# struct , created array of struct

struct finalmarks { public string studid; public dictionary<string, int> ques_mark; }; private finalmarks[] finalmark;

so, want store info table struct in stud_id wise...

for example,

finalmark[0].studid="s1" finalmark[0].ques_mark should contain next elements "q1"->8 "q5"->6

like finalmark[1] contains details of stud_id "s2"...

is possible write query using groupby or other functions in sql(mysql)?

please suggest me way this...

to info database using sql, you'd need query 1 of these.

-- final marks 1 pupil on 1 test. select ques_id, final_mark final_mark test_id = 1 , stud_id = 's1';

there's no hint in info or description makes sense add together final_marks together. (imagine recording temperature. doesn't create sense add together 20 degrees 15 degrees.) if does create sense, can total final marks each test , each pupil this.

select test_id, stud_id, sum(final_mark) sum_of_final_mark final_mark grouping test_id, stud_id

c# mysql sql

No comments:

Post a Comment