Using condition with conditional fields in custom queries

Try something like this in where clause:
CASE WHEN :P1 = ‘’ THEN table1.column = :P1 ELSE 1 = 1 END

and set :P1 = {{$_GET.var}}.

We have this setup at numerous places and it works well for us.

You can also use IFNULL but that is a bit trickier.

2 Likes