Why this code cannot delete the rows that i want?
The DeleteQuery class doesn't have orderBy or range functions, so I would imagine you would need to write your own DELETE with SELECT subquery. An example from Stack Overflow