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