Page 1 of 1

what's wrong with this query

Posted: Tue Jun 21, 2005 12:35 pm
by bluesman333
$sql = "SELECT
purchases.purchases_total AS purchases,
goals.misc_goals AS misc,
goals.product_goals AS product,
companies.clientID AS clientID,
companies.company_name AS name,
companies.state AS state
FROM companies, goals, purchases
WHERE companies.clientID = goals.clientID
AND companies.clientID = purchases.clientID
AND goals.goals_year = '$year'
AND purchases.purchases_year = '$year'
ORDER BY state, name
";

I'm not receiving any errors, the script just runs forever and never returns anything. It also forced my computer to crawl, so something was going on in the background. It worked fine until I added a third table. Does MySQL not support more than two tables? I also tried joining the other two tables, but that did not correct the situation.

Posted: Tue Jun 21, 2005 2:54 pm
by phpScott
you are probaly getting an absurd amount of results.

check your joins as that is probably what is happening.