Re: ON condition in LEFT OUTER JOIN doesn't work?!

Поиск
Список
Период
Сортировка
От Sam Mason
Тема Re: ON condition in LEFT OUTER JOIN doesn't work?!
Дата
Msg-id 20090409164010.GS12225@frubble.xen.chris-lamb.co.uk
обсуждение исходный текст
Ответ на ON condition in LEFT OUTER JOIN doesn't work?!  (Marcin Krol <mrkafk@gmail.com>)
Список pgsql-general
On Thu, Apr 09, 2009 at 06:34:27PM +0200, Marcin Krol wrote:
> SELECT hosts.id, MIN(reservation.start_date)
> FROM hosts
> LEFT OUTER JOIN reservation_hosts
> ON reservation_hosts.host_id = hosts.id
> LEFT OUTER JOIN reservation
> ON (reservation_hosts.reservation_id = reservation.id AND
> reservation.start_date > 2009-04-09)
> GROUP BY hosts.id ORDER BY hosts.id
>
> It selects the hosts with reservation.start_date = 2009-04-09 !

You are putting quotes in there, and not comparing to the number 1996
((2009 - 4) - 9), aren't you?  Old versions of PG would let this sort of
thing through I think, but newer versions will give an error.

--
  Sam  http://samason.me.uk/

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

Предыдущее
От: Sam Mason
Дата:
Сообщение: Re: complicated query (newbie..)
Следующее
От: Glyn Astill
Дата:
Сообщение: Re: Trigger function cost