Move the conditions to WHERE clause