select t.state,count(distinct t.name) from temp_table t
group by t.state
__________________
Found a flower or bug and don't know what it is ? agrozoo.net galery
if you don't spot search button at once, there is search form: agrozoo.net galery search
I looked to quick.
Explain what 3, in expected result, for sweden means ?
__________________
Found a flower or bug and don't know what it is ? agrozoo.net galery
if you don't spot search button at once, there is search form: agrozoo.net galery search
SELECT S.country, COUNT( DISTINCT S.minid ) AS theCount
FROM (
SELECT country, name, MIN(id) AS minid
FROM names
GROUP BY country, name
) AS S
GROUP BY S.country
ORDER BY S.country
???
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.