I have the following table:
ID height
personA 182
personA 182
personA 182
personA 192
personA 172
personB 175
personB 175
I would like to extract the most commonly appearing height for this individual as I suspect 192 was a typo. So far, I have:
select ID, height, count(ID,height) as cnt
from tbl
group by ID, height
having max(cnt);
My desired output is:
ID height
personA 182
personB 175
