pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rod Taylor <rbt@rbt.ca>
To: G. Ralph Kuntz, MD <grk@usa.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Q: select query
Date: Sat, 13 Sep 2003 14:17:16 -0400
Message-ID: <1063477035.66715.7.camel@jester> (raw)
In-Reply-To: <9881c752.0309120958.454c659c@posting.google.com>
References: <9881c752.0309120958.454c659c@posting.google.com>

> in other words, all but the first row of a group.

Interesting question. The below should work and be quick so long as
there is a UNIQUE(col1, col2) constraint.

SELECT col1
     , col2
  FROM j
 WHERE col2 != (SELECT col2
                  FROM j AS jsub
                 WHERE col1 = j.col1
              ORDER BY col2 ASC
                 LIMIT 1);

Attachments:

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

view thread (3+ messages)  latest in thread

Message-ID: <1063477035.66715.7.camel@jester>
Permalink:  ../1063477035.66715.7.camel@jester/
Also on:    postgresql.org/message-id/1063477035.66715.7.camel@jester

 · 

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: rbt@rbt.ca, grk@usa.net
  Subject: Re: Q: select query
  In-Reply-To: <1063477035.66715.7.camel@jester>

* 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