A requirement just popped up for me, where I have to delete rows with duplicate "MainUrl" but these rows have unique ID, generated as an auto-increment column. Thought, it would be a straight-forward thing, but not until I actually sat down writing the query. Finally, after some lookup and some meditation, I ended up with the following query.
DELETE FROM CrawledUrl
WHERE ID NOT IN
(SELECT MIN(ID)
FROM CrawledUrl
GROUP BY MainUrl)
AND IsProcessed <> 'True'
ERROR 1093 (HY000): You can't specify target table 'CrawledUrl' for update in FROM clause
1: delete FROM thesis.CrawledUrl
2: WHERE ID NOT IN
3: (
4: SELECT MIN(ID)
5: FROM (select Id,MainUrl from thesis.CrawledUrl) as x
6: GROUP BY MainUrl)
7: and IsProcessed = 'False'