Hey list;

Consider this statement:

SELECT * FROM products p, manufactors m, items i WHERE p.manufactor_id
= m.manufactor_id && p.product_id = i.product_id;

Now, each unique product_id from "products" can have more than one
entry in the "items" table, but I only want to fetch the one which
fullfills a certain criteria. In this case, I want the statement only
to JOIN the row if the column "item_updated" from the "items" table
equals "1".

Is this the proper way to solve this:

SELECT * FROM products p, manufactors m, items i WHERE p.manufactor_id
= m.manufactor_id && p.product_id = i.product_id && i.item_id =
(SELECT item_id FROM items i2 WHERE i2.item_updated = 1);

I find the above solution VERY slow, almost as if I have missed out on
a very fundamental part of the logic - but it does get the work done.
How could I speed this up, or solve it in another statement?

Regards
--
Kim Christensen

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to