From: Louis-David Mitterrand <vindex+lists-pgsql-sql@apartia.org>
To: pgsql-sql@postgresql.org
Subject: Re: UNION or LEFT JOIN?
Date: Tue, 16 Feb 2010 22:02:23 +0100
Message-ID: <20100216210222.GA20610@apartia.fr> (raw)
In-Reply-To: <f54607781002160733l5e6f6d6fg1821106498ab464b@mail.gmail.com>
References: <20100216140814.GA22577@apartia.fr>
<f54607781002160733l5e6f6d6fg1821106498ab464b@mail.gmail.com>
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!
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: vindex+lists-pgsql-sql@apartia.org
Subject: Re: UNION or LEFT JOIN?
In-Reply-To: <20100216210222.GA20610@apartia.fr>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox