pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adam Rosi-Kessel <adam@rosi-kessel.org>
To: Michael Glaesemann <grzm@myrealbox.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: ORDER BY does not work as expected with multiple joins
Date: Fri, 13 Jan 2006 10:22:57 -0500
Message-ID: <43C7C5D1.9030600@rosi-kessel.org> (raw)
In-Reply-To: <3AA68074-D959-442F-8329-79D09D5F9129@myrealbox.com>
References: <43C7BA12.90103@rosi-kessel.org>
	<3AA68074-D959-442F-8329-79D09D5F9129@myrealbox.com>

Thanks for your helpful response.

Michael Glaesemann wrote:
> I don't seem to have a problem with the ordering given your data. I'm
> not sure why you're doing right and left joins, though. You might want
> to use left joins if you have NULL id1 or id2, but otherwise just plain
> JOIN should work fine. I've included both your SELECT (slightly modified
> to avoid using key words) and how I'd probably right the statement.

id1 will always have a value but id2 can be NULL. So should I do a left JOIN
on id2 but a plain JOIN on id1? Is there a disadvantage to using a left JOIN
where it is not necessary?

Adam

Attachments:

  signature.asc (application/pgp-signature, 249B) download

view thread (9+ messages)  latest in thread

Message-ID: <43C7C5D1.9030600@rosi-kessel.org>
Permalink:  ../43C7C5D1.9030600@rosi-kessel.org/
Also on:    postgresql.org/message-id/43C7C5D1.9030600@rosi-kessel.org

 · 

reply

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: adam@rosi-kessel.org, grzm@myrealbox.com
  Subject: Re: ORDER BY does not work as expected with multiple joins
  In-Reply-To: <43C7C5D1.9030600@rosi-kessel.org>

* 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