On 18 Jun 2002, at 17:36, Joćo Paulo Vasconcellos wrote: > SELECT SUM( IF( STRCMP( active,'Y' ) = 0, 1, 0 ) ) as activeUsers > FROM usersTbl
Since comparisons return 1 or 0, a simpler way of writing that query is SELECT SUM( active = 'Y' ) as activeUsers FROM usersTbl (although things are more complicated if active can be NULL). -- Keith C. Ivey <[EMAIL PROTECTED]> Tobacco Documents Online http://tobaccodocuments.org --------------------------------------------------------------------- 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