Searching with MySQL

  • CazpianXI
  • Proficient
  • Proficient
  • User avatar
  • Posts: 285

Post 3+ Months Ago

I need to be able to search through a MySQL database. However, I already tried using WHERE MATCH(), but it doesn't work for what I need it to do.

I have a database of product serial numbers, but each serial number is appended with a timestamp. (Ex: 123serial123_6.25.2004) I need to be able to search through the database for a specific serial number... does MySQL have a function that can search inside of words?

I'd greatly appreciate any help you could give me.

~Cazpian the 11th
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Rabid Dog
  • Web Master
  • Web Master
  • User avatar
  • Posts: 3245
  • Loc: South Africa

Post 3+ Months Ago

have you tried the like statement?

Code: [ Select ]
SELECT * FROM table WHERE id LIKE "123serial123_%"


this will only work properly though if every serial number is unique.


Hope this helps
  • Scorpius
  • Proficient
  • Proficient
  • User avatar
  • Posts: 401
  • Loc: Scorpion Hole

Post 3+ Months Ago

You can also do this to look inside of the word, instead of only on the end of it.
Code: [ Select ]
SELECT * FROM `table` WHERE `id` LIKE '%1123_%'
  • CazpianXI
  • Proficient
  • Proficient
  • User avatar
  • Posts: 285

Post 3+ Months Ago

Ok, thank you very much!

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 117 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.