May 7, 20214 yr Hi guys, I'm scratching my head trying to use ExecuteSQL syntax. How can I prevent a division if a value is null or zero in a SELECT statement? Here's a simplified version of my query. "SELECT exp.labels, SUM (exp.budgeted) as budget" & ", SUM (exp.expenditure) as expense,"; "IF (expense > 0) SELECT (budget / expense) ELSE NULL"; // <--- THIS IS WHAT I WANT TO FIX "FROM expenditures AS exp"; "WHERE exp.id IN (" & ids & ")"; "GROUP BY exp.labels" Thanks Edited May 7, 20214 yr by El_Pablo
Create an account or sign in to comment