count on count (mysql query)

5 views
Skip to first unread message

shiplu

unread,
May 9, 2007, 10:52:25 AM5/9/07
to p2p...@googlegroups.com
Hi,
I have query like this,
mysql> Select count(*) `cnt` From t1 group by name;
+-----+
| cnt |
+-----+
| 120 |
| 320 |
+-----+
2 rows in set (0.01 sec)

But I need a query that will output
+-----+
| cnt |
+-----+
|   2 |
+-----+
1 row in set (0.00 sec)

Got the idea ?


shiplu

unread,
May 9, 2007, 11:05:37 AM5/9/07
to p2p...@googlegroups.com
I resolved it just now.

mysql> select count(*) `cnt` from (Select count(*) From t1 group by name) as P;

+-----+
| cnt |
+-----+
|   2 |
+-----+
1 row in set (0.14 sec)
Reply all
Reply to author
Forward
0 new messages