Try this:
select distinct
url
from
tbl_index a
where
(select count(*) from tbl_index b where a.url=b.url and b.keyword in ('word 1', 'word 2' . . .)) = n
where n
is the number of keywords you are searching for and 'word 1', 'word 2' etc are the keywords.
I suggest you create three tables: one with one row for each unique URL, with a numeric id and the url name, a second table with one row for each unique keyword, with a numeric id and the keyword and then a cross-reference table with all the pair url id - keyword id:
create table urls (
url_id int identity,
url varchar(800),
primary key (url_id)
)
create table keywords (
keyword_id int identity,
keyword nvarchar(50),
primary key (keyword_id)
)
create table urlkeys (
url_id int,
keyword_id int,
primary key (url_id, keyword_id)
)
In this way you should reduce the size of the data. The query above becomes something like this:
select
url
from
urls
where (select count(*) from urlkeys join keywords on urlkeys.keyword_id=keywords.keyword_id where urlkeys.url_id=urls.url_id and keywords.keyword in ('word 1', 'word 2' . . .)) = n
It would be a good idea to have an index on the keyword
column
P.S. this is the outline of a simplistic SQL solution, but as various people already pointed out in comments this is a problem best solved using a full-text search solution. As soon as you try to do something like stemming, proximity search, partial word searches, wildcards etc etc. any SQL-based solution will fall short.