edit query for adding LIMIT