Find One column information in concatenated information of another column SQL

I am a newbie and i have a scenario where brand (column1) is to be a part of the product title (column2) however there are scenarios where column1 info is missing in column2. I would like to export such IDs where the information from one column is supposed to be present as a part of the concatenated information of another column. If it were in excel, i would be using the FIND formula and if the formula has an error, it would represent the defective title. How can this scenario be translated in SQL ? (Lets Assume the Product title, brand and ID are present in table "PRODUCT_DATA"

Should i try instr()

 select * from PRODUCT DATA where column2 LIKE '%' + Column1 + '%'

or Use a temporary table or use switch case ??

I would really appreciate your inputs guys.

Thanks in advance :)

Upvotes: 0

Views: 33

Answers (1)

ScaisEdge
ScaisEdge

Reputation: 133390

In mysql you could try using concat and like

select * 
from PRODUCT_DATA 
where column2 LIKE concat('%' ,Column1 , '%')

Upvotes: 1

Related Questions