设有以下两表:
表a字段:
id,tag
表b字段:
id,title
查询目的:
当表a的tag包含在表b的title中时,才查询出来
目前代码大概是这样:
select a.tag from a with(nolock)
left outer join b with(nolock)
on charindex(a.tag, b.title) > 0
问题:
按我这个代码,执行时间很长,请问是否有更优的写法?谢谢!
id,tag
id,title
当表a的tag包含在表b的title中时,才查询出来
select a.tag from a with(nolock)
left outer join b with(nolock)
on charindex(a.tag, b.title) > 0
按我这个代码,执行时间很长,请问是否有更优的写法?谢谢!