user3794184
user3794184

Reputation: 1

Filter based on column value match in SQL

I want to write query that matches the value in a column with the value in another column.

example Column 1 value : Newport Column 2 Value: Medical Council Newport

I want to use a filter that select the rows where the entire value in column 1 matches with the column 2 partially.

i cant to use the filter condition based on string match

select * from tb1 
where column2 like '%Newport%' -- this doesnt work for me

Upvotes: 0

Views: 734

Answers (1)

M.Ali
M.Ali

Reputation: 69574

Try something like

SELECT * 
FROM TABLE_Name 
WHERE Col2 LIKE '%'+ Col1 + '%'

Upvotes: 3

Related Questions