Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 summing two rows from the same table

Author  Topic 

kanyau
Starting Member

1 Post

Posted - 2010-05-25 : 06:31:18
initially this is what i was using.
//////////////////////////////////////////////////////
SELECT students.regno,studentreg.stdregid, avg(examrec.cat + examrec.fexam) as marks from students, studentreg, classbus,examrec where students.regno=classbus.studentid and students.regno=studentreg.studentid and examrec.termregid=studentreg.stdregid and classbus.academicyr='.$year.'
and classbus.class='.$classid.' and studentreg.termid='.($q+1).' group by regno order by marks desc';
////////////////////////////////////////////////////////////////
it was working but for some inevitable reasons i had to change. i splitted the (examrec.cat and examrec.fexam)thus making them dift rows.
however am failing to generate a querry to sum from two fields
   

- Advertisement -