Here is an example of the current rows as is:
id sdate subject exam1 assgn1 overallmark result credits
____________________________________________________________________________
1 082013 Math 40.0 0.00 33 F 7.50
2 082013 Math 0.0 25.00 33 F 7.50
3 082013 Science 80.0 0.00 76 P 7.50
And this is what i want it to be:
id sdate subject exam1 assgn1 overallmark result credits
____________________________________________________________________________
1 082013 Math 40.0 25.00 33 F 7.50
Essentials i want to wrap multiple results of the same subject into one row, what would be the best way to go about this? I've attempted using GROUP_CONCAT
but my mysql knowledge isn't exactly up to scratch.
I've been using a simple MySQL query to get this results displayed in my first code block:
SELECT * FROM exam_results WHERE sdate = :sdate AND studno = :studno
Edit*
Thanks to user @echo_Me this solution works:
select id ,sdate,subject,sum(exam1)exam1,sum(assgn1)assgn1,overallmark,result,
credits from exam_results group by studno,subject
However, could the same syntax be used in postgres? How would i change it accordingly to fit in with a postgres installation?
exam1
andassgn1
marks is neccessary, if not then insert only one row for each student, and your problem is solved