Skip to content
Advertisement

I want to join two tables, removing duplicate values

I have to say I’m an amateur on MySQL, plus english is not my mother’s language.

Here is my first table “Teacher”:

And here my second table “Course”:

I would like to know which country has more teachers giving courses, but I don’t want that it count the same teacher twice. So far I made this:

When I run this, I obtain:

But the code counts John and Mike as two persons, I would like to remove that duplicity, so I would like to obtain:

Thanks a lot.

Advertisement

Answer

Use count(distinct):

One additional note: “procedence” is not at all a common English word. One word is “provenance”. I think more commonly “origin” or just “country” would be used.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement