You may try:


SELECT SUM( IF( STRCMP( active,'Y' ) = 0, 1, 0 ) ) as activeUsers
FROM usersTbl




On Tuesday 18 June 2002 16:36, Walter D. Funk wrote:
> Hi everybody!
>
> I need to count the ACTIVE users of my Mysql users table; where 'active' is
> a flag showing this status,
> using the following query it returns all the user in the table, and I need
> only those who have tha flag active set to 'Y'
>
> I know this could be done by using a where clause, but in this case it  is
> not possible, because this is actually only a part of the query and I do
> not want to limit the result set with a where clause,
>
> this is the query I am using, I tried other combinations , but it did not
> work  :-(
>
> SELECT IF( STRCMP(active,'Y') = 0 , COUNT(userId) , 0 ) as activeUsers FROM
> usersTbl
>
>
> any help will be appreciated,
> thanx
>
>
>
> ---------------------------------------------------------------------
> 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

-- 
Joćo Paulo Vasconcellos
Gerente de Tecnologia - NetCard
Tel. 21 3852-9008 Ramal 31
[EMAIL PROTECTED]

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