"Terence" <[EMAIL PROTECTED]> wrote:
> 
> Can this be done in one sql statment (without the use of sub-queries):
> 

Without subqueries - no.

> 
> 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.
> 




-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com




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

Reply via email to