SELECT SUM( test=x ) AS total, COUNT(*) AS pass FROM table WHERE text=x AND
value BETWEEN low AND high;

b.


Chris Thorpe wrote:

> Is it possible to modify the following query:
>
> SELECT COUNT(*) AS pass WHERE test=x AND value BETWEEN low AND high;
>
> to also count the total number of records where 'test=x'
> and hence return the percentage pass mark all within one statement, or am I
> stuck using 2 statements 1 as above to count the passes and a second :
>
> SELECT COUNT(*) AS total WHERE test=x;
>
> to count the total??????
>
> Chris Thorpe
> Consultronics Europe Ltd
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

--
Bill Adams
TriQuint Semiconductor




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to