insert @TempAddressParsingTable (ad_str1) select 'apple UNITY RD' union all select 'watermelon UNITY RD unit#32' union all select 'currency UNITY RD unit# 99' union all select 'marrakesh UNITY RD unit #32'
select * from @TempAddressParsingTable where ad_str1 like '%unit%' select * from @TempAddressParsingTable where ad_str1 like '%unit%' and ad_str1 not in (select ad_str1 from @TempAddressParsingTable where ad_str1 like '% unity %')
declare @TempAddressParsingTable table(
ad_str1 varchar(100) null)
insert @TempAddressParsingTable (ad_str1)
select 'apple UNITY RD' union all
select 'watermelon UNITY RD unit#32' union all
select 'currency UNITY RD unit# 99' union all
select 'marrakesh UNITY RD unit #32'
SELECT ad_str1 FROM @TempAddressParsingTable
WHERE ad_str1 LIKE '%unit %'
OR ad_str1 LIKE '%unit#%'