Re: [SQL] How to delete the not DISTINCT ON entries

2004-06-16 Thread Jean-Luc Lachance
If you do not have foreign key restrinctions, create a temp table from the select as: CREATE TEMP TABLE tmp AS SELECT DISTINCT ON (location) location, time, report FROM weatherReports ORDER BY location, time DESC; TRUNCATE weatherReports; INSERT INTO weatherReports SELECT * FROM tmp; HTH Achill

Re: [SQL] How to delete the not DISTINCT ON entries

2004-06-16 Thread Achilleus Mantzios
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 DI

[SQL] How to delete the not DISTINCT ON entries

2004-06-16 Thread Christoph Haller
Referring to the DISTINCT ON example SELECT DISTINCT ON (location) location, time, report FROM weatherReports ORDER BY location, time DESC; How would I delete those entries skipped by the DISTINCT ON expression? TIA Regards, Christoph ---(end of broadcast)