pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
complex join question 2+ messages / 2 participants [nested] [flat]
* complex join question @ 2010-02-12 22:32 Louis-David Mitterrand <vindex+lists-pgsql-sql@apartia.org> 2010-02-12 23:55 ` Re: complex join question Tim Landscheidt <tim@tim-landscheidt.de> 0 siblings, 1 reply; 2+ messages in thread From: Louis-David Mitterrand @ 2010-02-12 22:32 UTC (permalink / raw) To: pgsql-sql Hi, 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'. Thanks, ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: complex join question 2010-02-12 22:32 complex join question Louis-David Mitterrand <vindex+lists-pgsql-sql@apartia.org> @ 2010-02-12 23:55 ` Tim Landscheidt <tim@tim-landscheidt.de> 0 siblings, 0 replies; 2+ messages in thread From: Tim Landscheidt @ 2010-02-12 23:55 UTC (permalink / raw) To: pgsql-sql 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 ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2010-02-12 23:55 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2010-02-12 22:32 complex join question Louis-David Mitterrand <vindex+lists-pgsql-sql@apartia.org> 2010-02-12 23:55 ` Tim Landscheidt <tim@tim-landscheidt.de>
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