// count users with filter select Count(surname+firstname) as duplicates, surname, firstname from c_contact where show_record=1 group by surname, firstname having Count(surname+firstname) > 1 order by duplicates, surname, firstname // original code SELECT column,COUNT(*) c FROM table GROUP BY column HAVING COUNT(*) > 1 //update code update c_contact set duplicates = dbo.func_get_duplicates(surname, firstname)