sql server - ASP.NET/sql full text search -


i using below query fulltext searh sql server.

    declare @mytable table (id int identity(1,1), searched varchar(200)) declare @keys    table (word varchar(200), wordid int identity(1,1))  insert @mytable values ('mother father daughter son') insert @mytable values ('mother daughter son') insert @mytable values ('mother son') insert @mytable values ('daughter son') insert @mytable values ('mother father son') insert @mytable values ('son daughter father') insert @mytable values ('mother bun') insert @mytable values ('other word')   insert @keys values ('mother') insert @keys values ('father') insert @keys values ('son') insert @keys values ('daughter')  declare @nallwords int select @nallwords = count(*) @keys  select mytable.* @mytable mytable inner join (select mytable.id                    @mytable mytable             inner join @keys keywords on ' ' + mytable.searched + ' ' '% ' + keywords.word  + ' %'             group mytable.id             having count(distinct(keywords.word)) = @nallwords) tbl1 on mytable.id = tbl1.id 

but above code return single records below one.

mother father daughter son 

i need result full 4 words(mother father daughter son),next 3 words(mother daughter son),next 2 , next 1 results like

mother father daughter son mother daughter son mother father son       :       :  mother bun 

please advice me on multiple columns ,i trying 1 column now.once next i'll try multiple columns.

if remove below code query, give desired result!

having count(distinct(keywords.word)) = @nallwords 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

visual studio - TFS will not accept changes I've made to a Java project -