Multiple Variables on the same query

Hello all,

I’m trying to do a query with two variables. the goal is the end user can select what filter wants to use.

Two variables configured as TEXTBOX: V_PostalCode , V_City

SELECT * 
FROM your_table 
WHERE (postal_code = $V_PostalCode OR city = $V_City) 
AND deleted = 0

If I type on V_PostalCode it works as expected, but if I type on V_City does not work. if i break that query in two queries it works.

SELECT * 
FROM your_table 
WHERE postal_code = $Var_PostalCode 
AND deleted = 0

or

SELECT * 
FROM your_table 
WHERE city = $V_City
AND deleted = 0

what am I doing wrong?

What do you mean it does not work? Does it error, or does the query return nothing?

you might have to either end up using a CASE statement in your query (not recommended) or use and if else statement (better) or use a stored procedure that handles the latter (best)

If I submit postal_code it shows data, if I use city does not show any data

Please click on query inspector in each case and see what the where clause looks like