join with 1 row limit

Поиск
Список
Период
Сортировка
От Behringer Behringer
Тема join with 1 row limit
Дата
Msg-id 370933.72551.qm@web45205.mail.sp1.yahoo.com
обсуждение исходный текст
Ответы Re: join with 1 row limit  (Vibhor Kumar <vibhor.kumar@enterprisedb.com>)
Re: join with 1 row limit  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
In mysql this query works fine, what is the equivalent in posgresql?

SELECT *
FROM
products p LEFT JOIN
products_images pi ON p.id = pi.product_id  LIMIT 1
WHERE products.company = 7

postgresql complains about LIMIT

This also fails

SELECT p.*
FROM
products p LEFT JOIN
(SELECT id,server_id,format,product_id FROM products_images pi WHERE pi.product_id = p.id LIMIT 1) pi ON pi.product_id
=p.id 
WHERE p.store_id = 1

with
There is an entry for table "p", but it cannot be referenced from this part of the query.

also this fails

SELECT p.*,
(SELECT id,server_id,format,product_id FROM products_images pi WHERE pi.product_id = p.id LIMIT 1) as AS pi(id, type)
FROM products p
WHERE p.store_id = 1

thanks





В списке pgsql-novice по дате отправления:

Предыдущее
От: Jasen Betts
Дата:
Сообщение: Re: Collation and Case Insensitivity
Следующее
От: Vibhor Kumar
Дата:
Сообщение: Re: join with 1 row limit