MySql with HP-UX

I'm trying to use a simple mysql query using the where option.  I looked at a manual that I have and I can't this statement to work.  I wonder if there is some setting I am missing.
This statement works; select service from XXXinstances where service='XXX_3';
There are many of each X types.  There are X_1, XX_2, and XXXX_4, etc.
I'm trying to use a wide card %, like this;
select service from XXXinstances where service='%_3';
To select all of the _3 types/services.
Why does this not work?
Who is Participating?
slightwv (䄆 Netminder)Connect With a Mentor Commented:
Even with the LIKE syntax above beware that the '_' is a single character wildcard so it will match 'abcdef3'.

You will need to escape the '_'.

select ... like '%\_3';
johnsoneConnect With a Mentor Senior Oracle DBACommented:
With a wild card, you need to switch from = to LIKE.  Your query should be this:

select service from XXXinstances where service like '%_3';
Gerwin Jansen, EE MVEConnect With a Mentor Topic Advisor Commented:
Can you try using like instead of =

... where service like '%_3';

edit: after posting I saw the above 2 replies..
chimaAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.