Rich Allen wrote:
iH

this should work

test> select * from xt;
+----+-------+
| id | field |
+----+-------+
|  1 |     0 |
|  2 |     0 |
|  3 |     7 |
|  4 |     8 |
|  5 |     7 |
|  6 |     0 |
|  7 |     6 |
|  8 |     7 |
|  9 |     8 |
+----+-------+
9 rows in set (0.00 sec)

test> select count(distinct(field)) + (select count(*) from xt where field=0) - 1 from xt;
+----------------------------------------------------------------------+
| count(distinct(field)) + (select count(*) from xt where field=0) - 1 |
+----------------------------------------------------------------------+
| 6 |
+----------------------------------------------------------------------+
1 row in set (0.01 sec)
note that i subtract one since i counted a "0" value in the distinct part ...


- hcir

That's what I needed. Thanks!

--
John C. Nichel
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Reply via email to