Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MySql with HP-UX

Posted on 2013-01-02
5
Medium Priority
?
270 Views
Last Modified: 2013-01-02
Hello,
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?
0
Comment
Question by:chima
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 35

Assisted Solution

by:johnsone
johnsone earned 1000 total points
ID: 38736985
With a wild card, you need to switch from = to LIKE.  Your query should be this:

select service from XXXinstances where service like '%_3';
0
 
LVL 38

Assisted Solution

by:Gerwin Jansen, EE MVE
Gerwin Jansen, EE MVE earned 200 total points
ID: 38736992
Can you try using like instead of =

... where service like '%_3';

edit: after posting I saw the above 2 replies..
0
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 800 total points
ID: 38737014
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';

http://dev.mysql.com/doc/refman/5.0/en//string-comparison-functions.html
0
 

Author Closing Comment

by:chima
ID: 38738799
Thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this article, we’ll look at how to deploy ProxySQL.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question