From: Achilleus Mantzios <achill@matrix.gatewaynet.com>
To: Christoph Haller <ch@rodos.fzk.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to delete the not DISTINCT ON entries
Date: Wed, 16 Jun 2004 15:18:26 +0300 (EEST)
Message-ID: <Pine.LNX.4.44.0406161511460.2590-100000@matrix.gatewaynet.com> (raw)
In-Reply-To: <40D03499.84F9354F@rodos.fzk.de>
O kyrios Christoph Haller egrapse stis Jun 16, 2004 :
> Referring to the DISTINCT ON example
>
> SELECT DISTINCT ON (location) location, time, report
> FROM weatherReports
> ORDER BY location, time DESC;
maybe smth like
delete from weatherReports where (location,time,report) not in
(SELECT DISTINCT ON (location) location, time, report FROM weatherReports
ORDER BY location, time DESC)
Note:
Order by is very important, since it affects which rows are deleted.
>
> How would I delete those entries skipped by the DISTINCT ON expression?
>
> TIA
>
> Regards, Christoph
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
--
-Achilleus
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: achill@matrix.gatewaynet.com, ch@rodos.fzk.de
Subject: Re: How to delete the not DISTINCT ON entries
In-Reply-To: <Pine.LNX.4.44.0406161511460.2590-100000@matrix.gatewaynet.com>
References: <40D03499.84F9354F@rodos.fzk.de> <Pine.LNX.4.44.0406161511460.2590-100000@matrix.gatewaynet.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