[thelist] sorting averages by using PHP

Maximillian Schwanekamp lists at neptunewebworks.com
Fri Mar 25 14:45:01 CST 2005


Murat Tutumlu wrote:
> I have a table which named as Studentmarks1 with
> "Student_no, lesson, class, V1, V2, F1, V3, V4, F2"
> columns.
> "V1, V2, F1, V3, V4, F2" are numbers over 100. I
> printed averages of classes and it is sorting by class
> name as shown in code below.
> My problem is sorting by averages. I tried, but I
> couldn't.. 

What does the HTML part do here?  It seems to be just there to muddy the 
water.  Can you give an example table of what you want your output data 
to look like?  Also, what version of MySQL are you using?  If you're on 
4.1, subqueries might be useful here.  You could do a JOIN on on your 
original query to a subquery which computes the AVGs.  Maybe there is a 
better solution, but I am unclear on what you're trying to accomplish here.

-- 
Maximillian Von Schwanekamp
http://www.neptunewebworks.com/



More information about the thelist mailing list