I normally work in MS SQL and not MySQL so I could be wrong, but it seems that 
you should have some joins happening between the tables instead of having this 
in the Where clause:
 icons.iconId = resourceTypes.resourceTypeIconId
AND resources.resourceTypeId = resourceTypes.resourceTypeId
AND categories.categoryId = resource2category.categoryId
AND resources.resourceId = resource2category.resourceId

I'd try some LEFT, RIGHT, and INNER Joins and see if you get the results you 
were hoping for. 

HTH,

Cheryl

---- Matthew Macdonald-Wallace <matt...@truthisfreedom.org.uk> wrote: 

=============
Hi All,

Can someone please explain why the following query returns a number of  
search results for each article instead of a single copy of each  
article that matches?

SELECT DISTINCT resources.resourceId,
resourceTitle,
extract,
iconPath,
iconName,
resourceTypes.resourceTypeId,
resources.resourceTypeId
FROM resources,
icons,
resourceTypes,
categories,
resource2category
WHERE icons.iconId = resourceTypes.resourceTypeIconId
AND resources.resourceTypeId = resourceTypes.resourceTypeId
AND categories.categoryId = resource2category.categoryId
AND resources.resourceId = resource2category.resourceId
AND resourceTitle LIKE "%legal%"
OR keywords LIKE "%legal%"
OR extract LIKE "%legal%"
OR resourceTitle LIKE "%waste%"
OR keywords LIKE "%waste%"
OR extract LIKE "%waste%"
AND resourceIsActive = '1'
ORDER BY resourceTitle DESC

Thanks,

Matt
-- 
Matthew Macdonald-Wallace
matt...@truthisfreedom.org.uk
http://www.truthisfreedom.org.uk/

____ • The WDVL Discussion List from WDVL.COM • ____
To Join wdvltalk, Send An Email To: 
mailto:subscribe-wdvlt...@intm-dl.sparklist.com or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
       Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: crhew...@charter.net
To unsubscribe send a blank email to 
leave-50160786-2349296.9032bcafc912e9043bceba3eb58fe...@lists.wdvl.com
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.

____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: 
mailto:subscribe-wdvlt...@intm-dl.sparklist.com or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
       Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: arch...@jab.org
To unsubscribe send a blank email to 
leave-50162508-230552.f22dcf5120bad5a91a87f69f1e923...@lists.wdvl.com
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.

Reply via email to