From: Tim Landscheidt <tim@tim-landscheidt.de>
To: pgsql-sql@postgresql.org
Subject: Re: complex join question
Date: Fri, 12 Feb 2010 23:55:38 +0000
Message-ID: <m3vde2ko05.fsf@passepartout.tim-landscheidt.de> (raw)
References: <20100212223248.GA29691@apartia.fr>
Louis-David Mitterrand <vindex+lists-pgsql-sql@apartia.org> wrote:
> Here is my schema:
> cruise_line -> ship(id_line) -> cruise_type(id_ship) -> cruise(id_cruise_type)
> -> price(id_cruise, id_currency) <- currency (USD,GBP,EUR,CAD)
> (a 'cruise' is a 'cruise_type' + a date)
> I am trying to display a count of cruise's for each ship and each
> currency even if that count is 0.
> But I am having trouble building the query, as some 'cruise's might not
> (yet) have a 'price' in all currencies and so no link to 'currency'.
You're probably looking for a "LEFT JOIN".
Tim
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: tim@tim-landscheidt.de
Subject: Re: complex join question
In-Reply-To: <m3vde2ko05.fsf@passepartout.tim-landscheidt.de>
* 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