Concatenate variable with LIKE clause
Posted: Tue Sep 19, 2017 7:29 pm
Hello.
Please, I would like to concatenate an "AND" clause based on a variable value but I'm getting errors because of the 'LIKE' and '%%'.
This is what I'm doing:
Please, I'm geting SQL errors.
What is the correct way to escape a single quotation mark or use a clause WHERE using a variable?
Please, I would like to concatenate an "AND" clause based on a variable value but I'm getting errors because of the 'LIKE' and '%%'.
This is what I'm doing:
Code: Select all
{occurrenceType == "M" ? " AND occurrence.fk_doc = " + doctor + "" : " AND patient.nameLIKE '%'" + {patient_name} + "%'"}
What is the correct way to escape a single quotation mark or use a clause WHERE using a variable?