On Friday 02 March 2001 13:11, Tony Foiani wrote:
> Then you can grab the matching businesses by joining against this
>
> table:
> | SELECT bi.*
> | FROM bus_info bi, bus_search_words bsw
> | WHERE bsw.bus_id = bi.bus_id
> | AND bsw.search_word = 'target'
>
> Variations on this (probably adding DISTINCT or GROUP BY with some
> sort of counting option, etc) are probably necessary. If you're
> searching for multiple whole words, I'd suggest an "IN" clause.
>
> | my $word_list = join ', ', map $dbh->quote($_), @words;
> | my $sql = ( "SELECT bus_id" .
> | " FROM bus_search_words" .
> | " WHERE search_word IN ( $word_list )" );
> | my $ids_aref = $dbh->selectcol_arrayref($sql);
>
Is there any way to do one of the above queries if you want only the business
names that match all of the search words ? (Without using nested selects or
post-fetch processing in perl ?) If I understand correctly, the query
above that uses the "IN" clause returns all documents that match any of the
search words...