MySql. Cómo usar Self Join
Necesito usar Self Join en esta tabla.
+------------+------+--------+
| Country | Rank | Year |
+------------+------+--------+
|France | 55 | 2000 |
+------------+------+--------+
|Canada | 30 | 2000 |
+------------+------+--------+
|Liberia | 59 | 2001 |
+------------+------+--------+
|Turkey | 78 | 2000 |
+------------+------+--------+
|Japan | 65 | 2003 |
+------------+------+--------+
|Romania | 107 | 2001 |
+------------+------+--------+
Necesito usar auto-unión para saber qué países tienen el mismo año que Turquía. Mostrar el país y el año solamente.
Esto es lo que estoy tratando de hacer.
SELECT DISTINCT a.Country, a.Year
FROM table1 AS a, table1 AS b
WHERE a.Year=b.Year and a.Country='Turkey';
Googled auto unirse, y lo hizo.
Estoy recibiendo sólo Turquía. ¿Qué estoy haciendo mal?