I’m trying to export the DB records from the table via “SELECT INTO OUTFILE”.
Everything works. But I need to filter the records and this is the problem.
Here’s the code:
SELECT * INTO OUTFILE 'file.txt' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'
FROM table_name WHERE name LIKE '%John%' AND LENGTH(name) <= 10 ORDER BY name
This statement doesn’t work, but if I remove the “name LIKE ‘%John%'” condition, it works.
But I need to specify this LIKE condition, how can I accomplish it?
Thanks.
Could be a problem with the
%sign. Try replacingwith