Solved!--But Query Optimization for many-to-many tables
| From: | Milk Man | Date: | Tue, 25 Jul 2000 22:45:19 +0000 |
| Subject: | Solved!--But Query Optimization for many-to-many tables | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-1482@lists.php.net to get a copy of this message | ||
Dear all,
First I want to thank the group for helping me get it. This is the query:
SELECT * FROM Products, Join, Types WHERE Products.prodID = Join.prodID AND Join.typeID = Types.typeID AND Types.typeName LIKE 'AMD';
for the following 3 simple many-to-many tables.
Products:
---------
prodID Description
1
2
3
Types:
-------
typeID typeName
1 AMD 2 IntelJoin: ----- prodID typeID
1 1 1 2 2 1 3 2Should I arrange the postion of the clause of the AND operator to optimize the query??? Should I have ..... WHERE Types.typeName LIKE 'AMD' AND Types.typeID = Join.typeID AND Join.prodID = Products.prodID; instead of .....WHERE Types.typeName LIKE 'AMD' AND Join.prodID = Products.prodID AND Types.typeID = Join.typeID ; (Is there any difference?) instead of .....WHERE Join.prodID = Products.prodID AND Types.typeID = Join.typeID AND Types.typeName LIKE 'AMD'; I can manipulate by many ways, but the short question is "will it be DIFFERENT?" The Join table has a few times more records but way smaller in size than the Products table. Really appreciate it. Thanks. Milkman. ________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com