Re: Select Question

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Select Question
Дата
Msg-id 200402022043.00840.dev@archonet.com
обсуждение исходный текст
Ответ на Re: Select Question  (Jeff Eckermann <jeff_eckermann@yahoo.com>)
Список pgsql-general
On Monday 02 February 2004 19:38, Jeff Eckermann wrote:
> --- Martijn van Oosterhout <kleptog@svana.org> wrote:
> > See DISTINCT ON()
>
> Yes, for selecting.  For deleting, probably something
> like:
>
> delete from table t1 where exists (select 1 from table
> t2 where t2.code = t1.code and t2.date > t1.date);

Quick note that Jeff's solution doesn't handle the situation where you have
codes with the same date. You don't say whether this is possible or not. If
it is, you'll need to distinguish between rows based on some other column.

--
  Richard Huxton
  Archonet Ltd

В списке pgsql-general по дате отправления:

Предыдущее
От: Adam.Bukla@interia.pl (Adam Bukla)
Дата:
Сообщение: Re: Problem with API (libpq) - detailed error codes
Следующее
От: "Ben"
Дата:
Сообщение: Re: Very slow query - why?