troubleshooting Question

Printing different fields that have a common column value

Avatar of Dakdouk Roula
Dakdouk Roula asked on
MySQL ServerSQL
5 Comments2 Solutions42 ViewsLast Modified:
I created in mariadb a table “countrystatistic”   with a CountryName varchar(50), PrimaryLanguage varchar(50) and population int(11). I then insert it several countries.

I’m trying to write a query that would print the countries that share the same primary language. Somehow it’s not working out completely. I have this query but this one doesn’t print ALL the coutries with the common language.

SELECT ALL PrimaryLanguage,COUNT(Primarylanguage),CountryName
FROM countrystatistic
GROUP BY PrimaryLanguage
HAVING COUNT(PrimaryLanguage) > 1;


I tried using a lot of queries with Join. I either got only part of the answer or an error this gave me an error:

SELECT DISTINCT A.PrimaryLanguage, A.CountryName, B.CountryName
From countrystatistic A, countrystatistic B
Where A.PrimaryLanguage = B.PrimaryLanguage
AND A.count(PrimaryLanguage) > 1;

Can someone help me with this? Thank you!
ASKER CERTIFIED SOLUTION
Tomas Helgi Johannsson
Database Administrator / Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros