sql group by count distinct multiple columns