Re: UNION or LEFT JOIN? - Mailing list pgsql-sql

From Louis-David Mitterrand
Subject Re: UNION or LEFT JOIN?
Date
Msg-id 20100216210222.GA20610@apartia.fr
Whole thread Raw
In response to Re: UNION or LEFT JOIN?  (Oliveiros <oliveiros.cristina@gmail.com>)
List 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 by date:

Previous
From: Oliveiros
Date:
Subject: Re: UNION or LEFT JOIN?
Next
From: Tim Landscheidt
Date:
Subject: Re: UNION or LEFT JOIN?