Andrey.Kyurkchiev Andrey.Kyurkchiev - 4 months ago 6x
SQL Question

SQL IN query for approximate values

I am trying to retrieve information from a table using the SQL

I am using the following
and my logic is to search for fields containing the abbreviation 'SMS'. However, the query only retrieves values for 'Other Services'

How can I query for only a part of the value in the field?

This is the select function I am using:

select product_id ,product_name
from product
where product_name
IN ('Other Services','%SMS%')


IN operator doesn't take values with wildcard characters. Instead use LIKE operator.

select product_id ,product_name
from product 
where product_name='Other Services' 
OR product_name LIKE '%SMS%'