skip if latter value equal

From: Marcin Krawczyk <jankes(dot)mk(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: skip if latter value equal
Date: 2009-07-10 07:22:51
Message-ID: 95f6bf9b0907100022u41173cl2ef880a3952d3996@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Pavel Stehule 2009-07-10 07:35:13 Re: skip if latter value equal
Previous Message Tom Lane 2009-07-09 18:43:15 Re: FW: Query length limitation in postgres server > 8.2.9