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