pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Aaron Bono <postgresql@aranya.com>
To: Klay Martens <kmartens@wol.co.za>
Cc: patrick.jacquot@anpe.fr
Cc: cadiolis@gmail.com
Cc: pgsql-sql@postgresql.org
Subject: Re: Am I crazy or is this SQL not possible
Date: Fri, 2 Jun 2006 10:23:30 -0500
Message-ID: <bf05e51c0606020823n4cf643dakccd752666000a4d6@mail.gmail.com> (raw)
In-Reply-To: <6c800ab64b48492fa88fa92f4fc28625@wol.co.za>
References: <6c800ab64b48492fa88fa92f4fc28625@wol.co.za>

Only if you assume that ordering by unique_id and by date_sent are
equivalent.  That may be the case but I personally hate making assumptions
like that.  When someone goes into the database and updates records (clean
up bad data, etc.) your perfectly running query can suddenly produce bad
results.

-Aaron

On 6/2/06, Klay Martens <kmartens@wol.co.za> wrote:
>
>
> Sorry to stick my nose in here...
> would not this work better?
>
> SELECT broadcast_id,date_sent,status from broadcast_history where
> unique_id in (
> SELECT max(unique_id) from broadcast_history group by broadcast_id);
>
> Seems like a simpler option.
>

view thread (20+ messages)

Message-ID: <bf05e51c0606020823n4cf643dakccd752666000a4d6@mail.gmail.com>
Permalink:  ../bf05e51c0606020823n4cf643dakccd752666000a4d6@mail.gmail.com/
Also on:    postgresql.org/message-id/bf05e51c0606020823n4cf643dakccd752666000a4d6@mail.gmail.com

 · 

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: postgresql@aranya.com, kmartens@wol.co.za, patrick.jacquot@anpe.fr, cadiolis@gmail.com
  Subject: Re: Am I crazy or is this SQL not possible
  In-Reply-To: <bf05e51c0606020823n4cf643dakccd752666000a4d6@mail.gmail.com>

* 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