Re: Search by "AND"....
| From: | Koo | Date: | Wed, 13 Dec 2000 07:34:01 +0000 |
| Subject: | Re: Search by "AND".... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-30055@lists.php.net to get a copy of this message | ||
Thanks.. i'll look into it later. For the time being, can you let
me know how I can do the AND search with my existing tables?
It's quite urgent. Thanks again.
Joe Stump wrote:
>
> The easiest way would be to download my searching class, run a few scripts,
> and use it :O)
>
> http://www.miester.org/software - it's called Miester
> Search any you can see
> my site using it. It has support for multiple tables, boolean ANDS (OR's will
> work, but aren't used - Google doesn't use them...)
>
> --Joe
>
> On Wed, Dec 13, 2000 at 03:13:47PM +0800, Koo wrote:
> > I got two typical MySQL tables for fulltext search:
> >
> > table1 table2
> > ------ ------
> > wordID wordID
> > itemID word
> >
> > where "word" holds all words
> > ------------------------------------------------------
> > When I try to query the database for any items with
> > EITHER wordA OR wordB, I do the following:
> >
> > mysql> select itemID from table1,table2
> > where table1.wordID=table2.wordID
> > and (word like '%wordA%' or word like '%wordB%');
> >
> > It works.
> >
> > But when I want query for any items which contain BOTH
> > wordA AND wordB, the following query always outputs 0 rows.
> >
> > mysql> select itemID from table1,table2
> > where table1.wordID=table2.wordID
> > and (word like '%wordA%' and word like '%wordB%');
> >
> > Why? And what's the simplest way to accomplish my task?
> >
> > Many thanks.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
> ---
> Joe Stump
> PHP Programmer
> www.Care2.com