Struggling to filter a table using SQL query

I have a table which I want to filter by two columns: company_id and investor_id

select * from {{formatDataAsArray(}} investments
where investments.company_id=ANY({{multiselect1.value}})
AND case when {{select23.value > 0}} then investments.investor_id={{select23.value}} else true

I've written this query which attempts to filter by company_id and then by investor_id, if select23 > 0. If the value is 0, then I want it to return all investor ids (essentially ignoring this filter).

I am getting a parse error, have i written my code incorrectly?

Filtering by company alone works fine, i know the problem does not lie there.

Without seeing screenshots, I would change
when {{select23.value > 0}}

when {{select23.value}} > 0

Are you coding for the situation where select23.value is not set because the dropdown wasn't selected? if that case, you can use AND ( {{!select23.value}} OR investments.investor_id={{select23.value}} )