MySQL Search

Hi fellow quarantinies
W10, LO 6.4.0.3 and MySQL 8.0

I have a contact search form. The main form has a first name and last name text box (subform with everything I need). In order for my search to work properly I have to remove the sql for the last name search (with the sql included nothing works)
Here is the full code

SELECT
*
FROM
“contact”

WHERE
UCASE(“FirstName”) LIKE UCASE( CONCAT(’%’,:Var_FN,’%’)) OR (:Var_FN IS NULL)
AND
UCASE(“LastName”) LIKE UCASE( CONCAT(’%’,:Var_LN,’%’)) OR (:Var_LN IS NULL)

Where is my oops?

Thanks

Hello,

Try:

SELECT *
FROM "contact"
WHERE (UCASE("FirstName") LIKE UCASE(CONCAT('%',:Var_FN,'%')) OR (:Var_FN IS NULL))
AND   (UCASE("LastName") LIKE UCASE(CONCAT('%',:Var_LN,'%')) OR (:Var_LN IS NULL))

That worked! Thank you