Hi List,

Can this be done in one sql statment (without the use of sub-queries):



SELECT count(*) as total, status
FROM table
GROUP BY status

---------------

Absent     |     40
Present    |    60

and get this result:

Absent: 40%

something like:

SELECT ((count(total) OF status=Absent) / count(total records) * 100)
FROM table

I need to be able to divide the number of absent by the total number of
results (eg how many times the student attended class). Right now it's in
two queries and I was wondering if it's possible.

Thanks
Terence


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to