Jump to content


Photo

Query field with an underscore in it??


  • Please log in to reply
2 replies to this topic

#1 barkster

barkster
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts

Posted 02 September 2006 - 08:41 PM

I have a field that contains an underscore.  How can I do a query for the underscore since I just found that underscore really doesn't find underscore it is a wildcard in mysql.  I need to be able to query for the actual underscore.  For example.  Select Title where Title LIKE '10_%' doesn't give me what I want.

Results

10_1
100_2
1000_4
10_2
etc..

Looking for Result "10_%"

10_1
10_2
10_3


Thanks

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 02 September 2006 - 09:36 PM

The underscore is also a wildcard character (much like . in regexs) -- you need to escape it if you want to match an actual underscore.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 barkster

barkster
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts

Posted 02 September 2006 - 09:47 PM

Knew it had to be simple will try that Thanks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users