[Solved] Incorrect work of LIKE-instruction with MySQL

dBase, Calc, CSV, MS ACCESS, MySQL, PostgrSQL, OTHER
Post Reply
vladboscaneanu
Posts: 32
Joined: Wed Apr 30, 2014 2:08 am

[Solved] Incorrect work of LIKE-instruction with MySQL

Post by vladboscaneanu »

Hi all.
I have a database,in Base,working well with the instruction ... SELECT * FROM Table WHERE Column LIKE :input || '%'
But the same command,when I use Openoffice Base as a client,with MySQL(local), returns me the exactly value of (:input) only!So if I introduce just the first character,
I do not find anything.Can someone help?Thanks.
Last edited by vladboscaneanu on Tue May 27, 2014 3:47 am, edited 1 time in total.
LibreOffice last version on Windows 10
User avatar
Sliderule
Volunteer
Posts: 1278
Joined: Thu Nov 29, 2007 9:46 am

Re: Incorrect work of LIKE-instruction with MySQL

Post by Sliderule »

vladboscaneanu:

Please try the following Query:

Code: Select all

SELECT * FROM Table WHERE Column LIKE CONCAT(:input, '%')
Explanation: In the above, I am using the MySQL standard for concatenation with the CONCAT function. Since, if I understand, you want to find any input that starts with whatever is entered . . . including the CONCAT function to string together what is entered, followed the the text string '%' I think / hope will meet your needs.

I hope this helps, please be sure to let me / us know.

Sliderule

Thanks to ad [Solved] in your 1st post Subject (edit buton top right) if this isue has ben resolved.
vladboscaneanu
Posts: 32
Joined: Wed Apr 30, 2014 2:08 am

Re: [Solved]Incorrect work of LIKE-instruction with MySQL

Post by vladboscaneanu »

Thank a lot,my friend.
Have a good time.
LibreOffice last version on Windows 10
Post Reply