• If I exclude the if statement, the SELECT works perfectly.

    I just need to know if and how I can change the IF statements, so the conditions the the IF will work.