I have the following SELECT statement,
SELECT * From MyTable as t
WHERE
t.Key1 =
(SELECT Max(r.Key1) From MyTable as r
WHERE (Key2 = t.Key2 AND Key3 = t.Key3 AND Key4 = t.Key4))
AND
(Key2 = t.Key2 AND Key3 = t.Key3 AND Key4 = t.Key4)
which selects all the records I wish to delete from MyTable. However when I try to actually delete the records i.e. by changing SELECT * to DELETE, I get an error and I believe this is because you cannot use aliases with a DELETE statement.
How then would I go about deleting these selected records from MyTable?