verdrm Posted February 18, 2008 Share Posted February 18, 2008 I would like to return similar but not exact data matches from MySQL. Example: If I type 'Jeff' into a form field, I would like to get all records containing the word 'Jeff'. How do I do that? Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted February 18, 2008 Share Posted February 18, 2008 Use the LIKE operator and wildcards: SELECT * FROM tbl WHERE col = '%Jeff%' The % sign matches any character, any number of times. The an underscore(_) matches any character, but just once. Quote Link to comment Share on other sites More sharing options...
marcus Posted February 18, 2008 Share Posted February 18, 2008 You didn't even use the like operator SELCT * FROM `table` WHERE `column` LIKE '%Jeff%' Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted February 18, 2008 Share Posted February 18, 2008 Hmm. I guess that's what you get for trying to help when you're falling asleep! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.