Search code examples
mysqlwildcardsql-like

MySQL Finding data using IN and LIKE Wildcard


How would I go about doing something like:

SELECT * FROM mytable
WHERE people IN ('Jack', '%Bob%')

Finding all fields that either equal 'Jack' or contain 'Bob'? I don't think my example is the proper syntax because it's not pulling up any records.


Solution

  • Simply :

    SELECT * FROM mytable WHERE people='Jack' OR PEOPLE LIKE '%Bob%'