ASP.net+MSSQL中如何高效实现简单的多关键词查询?

比如用户输入: "microsoft google yahoo"
就要搜索既包含microsoft又包含google和yahoo的记录
难道只能用类似下面的条件了吗?有没有其他更简单更高效的方法呢?期待高手的回答!
indexs like '%microsoft%' and indexs like '%google%' and indexs like '%yahoo%'

幕布斯7119047
浏览 679回答 2
2回答

米脂

数据不多的时候按你的方法是最简单有效的方法,不过似乎应该用or而不是and?

慕尼黑5688855

select P_Name from  product where(charindex('microsoft',P_Name)>0or charindex('google',P_Name)>0or charindex('yahoo',P_Name)>0)没有最好, 只有更好
打开App,查看更多内容
随时随地看视频慕课网APP