i have once done somthing like this i don`t remember how i did it table names fields names,city i want to display the name and how many times the name is there and to which city the name belongs to select name,select count(name) from names group by names,city, from names