Either you are missing a constraint (one of the *AND* bits in a WHERE
clause) or you actually have duplicates in the join.  Can't tell which
without knowing more about the schema.

You could just use "select DISTINCT ..." and let MySQL get rid of the
duplicates.  That may be kinda slow on 5,000 rows though, depending on your
hardware/RAM and the phase of the moon.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Daniel Masur <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Monday, September 17, 2001 9:21 AM
Subject: searching trought multiple tables


> i have a mysql database with 100 entrys in 3 tables.
>
> i need to search trought them, but if i search for 'a' in all tables, i
get
> 5000 results...
>
> 70 results are the same.
>
> heres my code:
> $sql_find="
> SELECT
>  mieter.miet_name, mieter.cat_id, mieter.id,
>     mieter.miet_beschreibung, cat.cat_name, events.name
> FROM
>  mieter AS mieter,
>  categories AS cat,
>  events AS events
> WHERE
>     mieter.miet_name LIKE '%$words%'";
>     if($option1) $sql_find = $sql_find . " AND mieter.cat_id =
'$option1'";
>     $sql_find = $sql_find . " OR mieter.miet_beschreibung LIKE
'%$words%'";
>     $sql_find = $sql_find . " or events.name LIKE '%$words%'";
>
> with $option1 enabled you can search trought subcategories. can anybody
help
> me?
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to