I have a database with two tables: one is a table for people, indicating which sports they practice; the second is a sports table shows which sports represent each id.
persons table
id name sport1 sport2
100 John 0 3
101 Max 1 3
102 Axel 2 4
103 Simon 4 2
sports table
sportid sportn
0 Football
1 Baseball
2 Basketball
3 Hockey
4 Swimming
I want to do a query where it shows me what sports Max practices, something like this
id name sport1 sport2
101 Max Baseball Hockey
So far I got this
select p.id, p.name, s.sportn, s.sportn
from persons as p, sports as s
where p.sport1 = s.sportid and p.id = 101
This shows me the first sport twice, so I don't know where to go from here.