Для Кучи.
Смотри: таблицы table1 (id,table2_id),
table2 (id,name)
table1 (1,NULL)
(2,1)
(3,NULL)
(4,2)
(5,3)
table2 (1,'Вася')
(2,'Петя')
(3,'Гога')
(4,'Степа')
Select table1.id,table2.name
from table1 left outer join table2 on table1.table2_id = table2.id
получится
1,NULL
2,'Вася'
3,NULL
4,'Петя'
5,'Гога'
это левый outer join
Select table1.id,table2.name
from table1,table2
where table1.table2_id = table2.id
2,'Вася'
4,'Петя'
5,'Гога'
типичный пример inner joinа
|