Thanks very very much Allen, works a treat
"Allen Agee" <ag****@yahoo.com> wrote in message news:45*************************@posting.google.co m...
"Mark Reed" <ma*********@ntlworld.com> wrote in message news:<6MG_b.662$bJ1.237@newsfe1-win>...
Hi Allen,
I have tried your query but I get the following error message....."you
have written a subquery that can return more than one field without using
the exists reserved word in the main query's FROM clause. Revise the select
statement of the subquery to request only one field".
I had to change it slightly as there were no fields selected to delete.
Also, I can't find any reference within the help files to "exists".
Mark
Mark,
That's what I get for hitting the send button before testing the
query!
It looks like your original query, SELECT Table1.[Date],
Min(Table1.Ball) AS MinOfBall FROM Table1 Group By Table1.[Date], is
trying to delete the minimum [Ball] for each Date.
To be safe, we ought to use the primary key of Table1 to prevent
deleting too many records. We can split the process into a select
query (qrySel) and our delete query (qryDel).
qrySel would look like:
SELECT First(Table1.ID) AS FirstOfID, Table1.date, Min(Table1.ball) AS
MinOfball FROM Table1 GROUP BY Table1.date;
qryDel would look like:
DELETE * FROM Table1 WHERE id in (Select FirstOfID from qrySel);
It's a good idea to make a backup before testing delete queries like
this.
Regards,
Allen