Lets say I have two tables:
Table1
Id Name
1 Joe
2 Greg
3 Susan
4 Max
Table2
Uid comment
2 Good customer
4 Great guy
What I want to do is list all elements of Table 1, and if Table1.Id = Table2.Uid I want to select this comment. If comment does not exist give blank field.
Result should be:
1 Joe
2 Greg Good customer
3 Susan
4 Max Great Guy
I can't figure out how to do it, if I write:
select
table1.Id,
table1.Name,
table2.comment
where
table1.id=table2.Uid
It gives me only users 2 and 4.