pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marcin Krawczyk <jankes.mk@gmail.com>
To: pgsql-sql@postgresql.org
Subject: skip if latter value equal
Date: Fri, 10 Jul 2009 09:22:51 +0200
Message-ID: <95f6bf9b0907100022u41173cl2ef880a3952d3996@mail.gmail.com> (raw)

Hi list,

I was wondering if it was possible for a field in SQL query to return NULL
if latter value is exactly the same ? - for given ORDER BY clause, I guess.
For example, query returns:

xxyy  1  4  true
xxyy  5  7  true
xxyy  21  8  true
yyzz  5  1 false
yyzz  7  7 false
yyzz  8  34 false

I'd like the output to be:

xxyy  1  4  true
NULL  5  7  NULL
NULL  21  8  NULL
yyzz  5  1 false
NULL  7  7 NULL
NULL  8  34 NULL

Is there any magical trick to achieve this ?

regards
mk

view thread (3+ messages)  latest in thread

Message-ID: <95f6bf9b0907100022u41173cl2ef880a3952d3996@mail.gmail.com>
Permalink:  ../95f6bf9b0907100022u41173cl2ef880a3952d3996@mail.gmail.com/
Also on:    postgresql.org/message-id/95f6bf9b0907100022u41173cl2ef880a3952d3996@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: jankes.mk@gmail.com
  Subject: Re: skip if latter value equal
  In-Reply-To: <95f6bf9b0907100022u41173cl2ef880a3952d3996@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