My MySQL table country_phone_codes looks something like this
id country_code area_code name
---------------------------------------------------------
You need to group your country_code also then & then only you will get correct matching results.
SELECT country_code,name
FROM country_phone_codes
group by country_code
ORDER BY country_code
And we should need to avoid use of Distinct
in select clause as it gives performance issues.
Instead of that we can use group by