|
|
|
| Вот он
select product . title ,pricelist2product . price, currency . title, currency . sign
from product left join pricelist2product on (pricelist2product.productId = product.id)
left join pricelist on (pricelist . id = pricelist2product . pricelistId )
left join currency on (currency . title = pricelist . currencyId)
Он связывает 4 таблицы. две первые все нормально, а вот pricelist и currency неправильно.
помогите разобраться пожалуста?.. | |
|
|
|
|
|
|
|
для: Полина
(16.04.2008 в 22:07)
| | что значит "неправильно"? | |
|
|
|
|
|
|
|
для: Root
(16.04.2008 в 22:09)
| | ну должен вывести
книжка| 22.70 |руб. |рубль
а выводит
книжка| 22.70 |NULL |NULL | |
|
|
|
|
|
|
|
для: Полина
(16.04.2008 в 22:15)
| | во-первых left join отбирает записи из таблицы независимо от того есть ли записи в связанной таблице, может их нет?
попробуй такой запрос:
select product . title ,pricelist2product . price, currency . title, currency . sign
from ((product left join pricelist2product on (pricelist2product.productId = product.id))
left join pricelist on (pricelist . id = pricelist2product . pricelistId ) )
left join currency on (currency . title = pricelist . currencyId) | |
|
|
|