Supponiamo che il campo in cui hai l'URL si chiami link:

$sql = "SELECT distinct(SELECT SUBSTRING_INDEX(link, '/', 1))
FROM TABELLA";