Having problems with a join statement. The code itself is working, but it's not showing up all the records I want.
Lag = Teams in the database
Spelare = Players in the database
The "join Spelare S on L.Klubb" is joining the teams in the two tables.
My problem however, is that not all team's are added into Lag L which makes them not show up.
The only results shown are where the players have a team that's also added into the table Lag. If the team is not added there it doesn't show up (probably because of the joined statement and the "where NOT L.Division = 'NHL') ?
I want all records but NOT L.Division = 'NHL' to show up, even the ones that doesn't have a team in the Lag table.
Should I use NULL somehow to identify the "unknown" teams or something?
select S.* from Lag L join Spelare S on L.Klubb = S.Klubb where NOT L.Division = 'NHL' and S.Rattigheter is null and S.Alder > 17 and S.Alder < 30 order by (S.Off+S.Def) * (S.Potential*4) / (S.Alder*3) DESC