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? Link to comment https://forums.phpfreaks.com/topic/91770-query-similar-data/ 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. Link to comment https://forums.phpfreaks.com/topic/91770-query-similar-data/#findComment-470017 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%' Link to comment https://forums.phpfreaks.com/topic/91770-query-similar-data/#findComment-470034 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! Link to comment https://forums.phpfreaks.com/topic/91770-query-similar-data/#findComment-470036 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.