IF Statement in a SQL Query

IF Statement in a SQL Query

I would like some help creating the following query if anyone is able to help. I am running into an error and not sure if it is my logic or a Zoho reports limitation.

Goal:
I would like to add a column in my table where if the MinDate is within 6 months of the TransactionDate then put 40, and if the MinDate is older than 6 months from the TransactionDate put 20.

I currently have a query in Table2 with the MinDate Expression and then another table Tabe1 with the TranacationDate. I have already joined them, but whenever I add an IF statement in my join it errors out.

Can someone suggest a better way to do what I am trying to do?

Thank you very much in advance!