pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gnanakumar <gnanam@zoniac.com>
To: pgsql-sql@postgresql.org
Subject: Is it possible to get DISTINCT rows from RETURNING clause?
Date: Thu, 17 Feb 2011 12:35:51 +0530
Message-ID: <003d01cbce71$1eaf1c90$5c0d55b0$@com> (raw)

Hi,

Is it possible to get DISTINCT rows from an UPDATE statement using RETURNING
clause?

"MYTABLE" columns are:
	APRIMARYKEYCOLUMN
	ABOOLEANCOLUMN
	EMAIL
	COLUMN1
	COLUMN2
	COLUMN3

UPDATE using RETURNING clause query:
UPDATE MYTABLE SET ABOOLEANCOLUMN = true FROM MYTEMPTABLE WHERE EMAIL =
MYTEMPTABLE.EMAIL RETURNING EMAIL, COLUMN1, COLUMN2, COLUMN3;

Here in this case, I expect to return distinct rows from these columns:
EMAIL, COLUMN1, COLUMN2, COLUMN3. 

I even tried out some ways of getting distinct rows, but it doesn't work.
Though I can still solve this at application layer, I'm trying to find
whether this could be controlled at query-level.  Any different
ideas/suggestions are appreciated.

Regards,
Gnanam




view thread (4+ messages)  latest in thread

Message-ID: <003d01cbce71$1eaf1c90$5c0d55b0$@com>
Permalink:  ../003d01cbce71$1eaf1c90$5c0d55b0$@com/
Also on:    postgresql.org/message-id/003d01cbce71$1eaf1c90$5c0d55b0$@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: gnanam@zoniac.com
  Subject: Re: Is it possible to get DISTINCT rows from RETURNING clause?
  In-Reply-To: <003d01cbce71$1eaf1c90$5c0d55b0$@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