Go4Expert (http://www.go4expert.com/)
-   MySQL (http://www.go4expert.com/forums/mysql-forum/)
-   -   select maxcount (http://www.go4expert.com/forums/select-maxcount-t19766/)

divinequran 15Oct2009 08:52

select maxcount

How do i select max count of a table in a single query.


select type, count(*) as cc, maxcount from t1 group by type;
This is a example query i want the max row count to be printed in the same row. Is it possible?

nimesh 15Oct2009 12:41

Re: select maxcount
what do you want in the max row count?

Do you want the rowcount of the recordset returned after the group by?

can you give an example?

divinequran 7Dec2009 20:36

Re: select maxcount
I have a table with a categories like emp1, emp2, emp3 e.t.c.

I want select the the max count of the category emp1 that is total now of rows of emp1. with where group=tempemp

where i will use where clause..

nimesh 7Dec2009 23:55

Re: select maxcount
what you want is just the count.
There is no such things as max count

count is just the count of records
max is the maximum value of all the values in a particular column for a table

If you are still referring to your original query, you need to modify it like this.
select type, count(*) as cc from t1 group by type;

All times are GMT +5.5. The time now is 07:32.