Okay, I've got a table called "searchindex" with two fields: wordid and textid. I need to find the text ids that have wordid a and b. This is the only way I have found to do it:
SELECT DISTINCT s1.textid FROM searchindex AS s1, searchindex AS s2 WHERE s1.textid=s2.textid AND s1.wordid=1670 AND s2.wordid=2375
The problem is, when I need to do more then two ands, or even just two, this can take a horribly long time because my table for searchindex is very large. Does anyone know a better way I can do this? I'm using MySQL, by the way. Thanks.
SELECT DISTINCT s1.textid FROM searchindex AS s1, searchindex AS s2 WHERE s1.textid=s2.textid AND s1.wordid=1670 AND s2.wordid=2375
The problem is, when I need to do more then two ands, or even just two, this can take a horribly long time because my table for searchindex is very large. Does anyone know a better way I can do this? I'm using MySQL, by the way. Thanks.