Reputation: 91
I hava a table Person and a table Club.
I am using a sql statement to link Person to Club because there is a field PersonclubID that i want to link to the name of the club (ClubName). They are in relation with the ID as you can see in the sql statement.
Now it shows me all the persons who have a clubID but I also want those without one.
statement:
select * from Person AS p INNER JOIN club AS c ON p.club_id =c.id where isTrainer = false
regards
Upvotes: 1
Views: 40
Reputation: 2556
Use a LEFT JOIN
in that case. It will show you all Person
rows and will have values for the Club
rows that are matched. Rows that do not match will contain NULL
values for Club
values
NB: Experiment with the Joins a bit :) Enjoy it
Upvotes: 1