http://stackoverflow.com/questions/2483492/mysql-query-select-distinct-column1-group-by-column2
Replacing
FROM tablename
with FROM (SELECT DISTINCT * FROM tablename)
should give you the result you want (ignoring duplicated rows) for example:SELECT name, COUNT(*)
FROM (SELECT DISTINCT * FROM Table1) AS T1
GROUP BY name
Result for your test data:dave 2
mark 2
This is the subquery.
2
you can use
COUNT(DISTINCT ip)
, this will only count distinct values
No comments:
Post a Comment