Since we are just tossing out development environments. We moved to Aptana in conjunction with TortoiseSVN for a team environment development timelines dropped. Personally I do not feel any gui editor makes you a better programmer, maybe you understand the fundamentals a little less. Not that anything so far has been an answer to your question. Developing mysql statements that not only require minimum resources but that are highly effective. Take a lot of trial and error. I feel there is no better tool in my mind to test query concepts than NaviCat. Not only is the product very user friendly but as a senior developer it gives me more insight into the impact the query has on my servers. Always think longevity of the product you are producing. Imagine one day you have 650,000 products how will the query impact the service you have written. I feel as a certified MySQL DBA you should understand that what works today may NOT be the best choice in query statements for the future. Always analyze your query statements for query length and system resources requirements. Depending on the structure of your database/tables/fields your query may be achieved many different ways. I might suggest you try an extended select statement. "SELECT product from sometable WHERE product='$array1' AND product=(SELECT product_name from sometable where other matching critera)"; By extending or what some may call concating the statement the return is more effective. Richard L. Buskirk -----Original Message----- From: Ben Miller [mailto:biprellim@xxxxxxxxx] Sent: Saturday, November 20, 2010 3:54 PM To: 'php-general' Subject: MySQL Query Help Hi, I'm building a website for a client in which I need to compare their products, side-by-side, but only include criteria for which all selected products have a value for that criteria. In my database (MySQL), I have a tables named "products","criteria" and "criteria_values" If I have something like $selected_product = array("1"=>"Product 1","2"=>"Product 2"...) // All products selected for comparison by the user I need to get only rows from "criteria" where there is a row in "criteria_values" matching "criteria.criteria_id" for each $selected_product - in other words, if any of the $selected_product does not have a row in "criteria_values" that matches "criteria.criteria_id", that criteria would not be returned. I hope that makes sense. I've played around with a few join queries, but none have given the desired results. Best I've been able to come up with so far is to query "criteria" for each DISTINCT(criteria_id) and then run through each $selected_product to make sure each has a criteria_value with a matching criteria_id, eliminating any criteria where the number of criteria_values < count($selected_product), but this seems pretty inefficient. Thanks in advance for any help. Ben Miller -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php