how to select records from two columns where one column consist word from second column? In postgres I want to select rows where column1 matches column2 for corresponding row and returns result having same values as well as records consisting word from column1.
select * from table_name where &quot;column1&quot; ILIKE &quot;column2&quot;; 

i am using above query but it returns exact matches, it should also return rows consisting words from column1 in column2.
column1 | column2
hello   | hello
please  | please guys
help    | help me
query   | website

my above query returns
column1
hello

i want it to return
column1
hello
please
help
Do you need it to be case sensitive? If not try using LIKE
Create Table #Test
(
ColA Varchar(100)
,ColB Varchar(100)
)

Insert Into #Test
Values ('TEST', 'THIS IS A TEST')
,('String', 'This Also has word string in it')
,('ABC','DEF')
,('123','456')


Select      *
From        #Test 
Where       ColB Like '%' + ColA + '%'