I'm implementing a search on a simple database with about 7 relevant fields. The idea is to CONCAT
the 7 fields and find the search term using the LIKE
operator. Records that don't match have a flag (filter
) that's set to zero.
UPDATE mapping SET FILTER = 0 WHERE id IN(
SELECT id WHERE
CONCAT(Field1, Field2, F3, F4, F5, F6, F7) NOT LIKE "%searchTerm%"
);
This works like a charm on my local dev with MySQL.
But, my host uses MariaDB and I get an error message:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE CONCAT( targets, organizations, ' at line 4.
I've isolated the SELECT statement (and added from mapping
), and that works, too. But, the update only works locally, not on a live site.
I've been wracking my brains since last night. Any ideas?