mysql - Count rows returned from a GROUP BY -
i have query
select count(*) `applications` approved =0 group user_id order `applications`.`user_id` asc
which ( in case ) returns 2 rows this
count(*) 1 1
but count isn't counting whole query, 1 row @ time. how desired output?
count(*) 2
edit
the reason group users have more 1 application counts 1. example
john has 4 applications tracy has 1 applications fred has 2 applications
total count returned 3.
this return 2:
select count(distinct user_id) applications approved = 0
it's hard tell whether want or dvk's answer right, because both return same answer when each user has 1 matching row.
Comments
Post a Comment