
Originally Posted by
June7
Delete data, sacrilege! Are you sure you won't regret this? The purpose of queries is to manipulate raw data to produce desired output without actually eliminating anything. That is the solution Khalid is suggesting. It returns the Min and Max values for each Name. This will not tell which records provide the Min and Max but is that important?
However, if you must delete, first do a query that retrieves the IDs that have the Min and Max values. This won't be easy.
Then build DELETE query based on the first:
DELETE FROM tablename WHERE NOT ID IN firstqueryname;
Our point is that if the first query can be accomplished, why bother with the DELETE?