Using SQL is it possible to search via string without regards to the order of the characters?

226 Views Asked by At

I would like to be able to search using a sql query without regarding the order of the characters within a string:

the search for 'black box'

should return 'box black 32oz 2 pack', 'box black 32oz 4 pack'

currently it does not return any of it.

I must search by 'box black' to receive a query result

SELECT DISTINCT Hetype.Description,
  Item.Type
FROM Item
  INNER JOIN Hetype ON Item.Type = Hetype.Type
WHERE Hetype.Description LIKE '%black box%' IGNORE CASE  

1

There are 1 best solutions below

0
On BEST ANSWER

You can use two LIKE expressions:

WHERE Hetype.Description LIKE '%black%' IGNORE CASE AND
      Hetype.Description LIKE '%box%' IGNORE CASE