Re: UNION or LEFT JOIN?

Поиск
Список
Период
Сортировка
От Louis-David Mitterrand
Тема Re: UNION or LEFT JOIN?
Дата
Msg-id 20100216210222.GA20610@apartia.fr
обсуждение исходный текст
Ответ на Re: UNION or LEFT JOIN?  (Oliveiros <oliveiros.cristina@gmail.com>)
Список pgsql-sql
On Tue, Feb 16, 2010 at 03:33:23PM +0000, Oliveiros wrote:
> Louis-David,
> 
> Please advice me,

Hi Oliveiros,

> if some cabin doesn't have a price i.e. it is not available, is there some
> way to tell
> which cruise it belongs to?

In fact a cabin belongs to a ship and CAN be associated to a 'cruise'
event with a price(id_cruise,id_cabin) object.

> You have PRICE table which seems to me to be an associative table between
> cruise and cabin, is this correct?

Yes,

> But, if the price doesn't have a register for that pair
> (îd_cabin,id_cruise), how do you know that cabin belongs to that cruise, in
> this case, cruise nº 1?

I am trying to display a list of all cabins of a ship for a certain
cruise even if some prices are missing, so the user sees what cabins are
not available.

After much trial and error I was finally able to build a left join query
that works.

Thanks a lot for offering your help!


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

Предыдущее
От: Oliveiros
Дата:
Сообщение: Re: UNION or LEFT JOIN?
Следующее
От: Tim Landscheidt
Дата:
Сообщение: Re: UNION or LEFT JOIN?