Meshredded Meshredded - 5 months ago 17
SQL Question

filter culmns in sql

from wolrd database available right here http://downloads.mysql.com/docs/world.sql.gz i want to display only the names of the countries speaking more than 5 languages :

i've tried this :


SELECT country.Name, COUNT(countrylanguage.Language) as languages
FROM country, countrylanguage
WHERE country.Code = countrylanguage.CountryCode
Group BY country.Name
HAVING languages >= 6



but the problem is that is it shows the number of languages as well, what i want is only the culumn country.Name .

Thank you.

Answer

with ANSI style INNER JOIN.

SELECT country.Name
FROM country INNER JOIN countrylanguage
ON country.Code = countrylanguage.CountryCode 
Group BY country.Name
HAVING COUNT(countrylanguage.Language) >= 6