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 T1GROUP BY nameResult for your test data:dave 2mark 2
This is the subquery.
2
you can use
COUNT(DISTINCT ip), this will only count distinct values
No comments:
Post a Comment