Correct syntax for concat inside a SQL query

I'm just trying to use this logic.
where ps.staff_id {{ selectOperator.value === null ? '> 0' : '={{selectOperator.value}}' }}
The syntax isn't correct, clearly. Is there a way to concatenate inside these {{ }} if statements to include a string and a stored value?

Are you using a Query JSON with SQL?
If not I would use a temp state instead.
OR you can use a CASE statement in it.

This is an example I use in Where clauses to do a text search. This uses concat inside the mustaches. Might it be what you are looking for?:

({{txtSearchProduct.value || null}} IS NULL OR (p.product_name like {{'%' + txtSearchProduct.value + '%'}} or p.product_description like {{'%' + txtSearchProduct.value + '%'}}) )

Also each database will have a different syntax. Postgres uses || instead of + for instance.

1 Like