Add if statement from Retool in SQL query

Hi everyone,

I have a normal "SELECT" MYSQL-Query in a Resource. If a date field in a form is filled, I want to run the query but add an additional "AND value_from > {{}}. That's because I only want to filter for the dates if a date is filled in the form. Otherwise, I want to show all records without date filtering. Info: default value in the date vield in the database is NULL.

How can this be done?
Thanks for your help.



Hey @thim-jbm! It sounds like you might be looking for something like this:

Let me know if you have any questions!