KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I need to use Self Join on this table. +------------+------+--------+ | Country | Rank | Year | +------------+------+--------+ |France | 55 | 2000 | +------------+------+--------+ |Canada | 30 | 2000 | +------------+------+--------+ |Liberia | 59 | 2001 | +------------+------+--------+ |Turkey | 78 | 2000 | +------------+------+--------+ |Japan | 65 | 2003 | +------------+------+--------+ |Romania | 107 | 2001 | +------------+------+--------+ I need to use self join to get what countries has the same year as Turkey. Display the Country and year only. This is what I am trying to do. SELECT DISTINCT a.Country, a.Year FROM table1 AS a, table1 AS b WHERE a.Year=b.Year and a.Country='Turkey'; ^ googled self join, and made it. I am getting only Turkey. What am I doing wrong?
Tags (comma-separated)
Save Edits
Cancel