trouble: joining more than 2 tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I am having a little trouble with joining more that two tables.

I can join two tables but once I start to add more tables to the WHERE
clause only two records show up.

I am still pretty new to MySQL, but I am learing.  I am just stuck on this
one in hopes someone will show me the light.
I tried reading the manual and used there samples but this is as far as I
got and seems to work but only some what.

Here is my query I am trying to use in DreamweaverMX (this one pulls up only
2 records, I have seven records for test purpose):

-SELECT instockID,  instock.materialCode, instock.treatmentCode,
instock.bulkCode, instock.shapeCode, instock.calibrate, instock.price,
-material.materialName, material.sDiscription, material.matImage1,
-shape.shapeName,  bulk.bulkName,  treatment.treatmentName
-
-FROM instock, material, shape, bulk, treatment
-
-WHERE instock.materialCode =  'colname'  AND
-instock.shapeCode = shape.shapeCode AND
-instock.bulkCode = bulk.bulkCode AND
-instock.treatmentCode = treatment.treatmentCode AND
-instock.materialCode = material.materialCode
-
-ORDER BY instock.shapeCode ASC

This one I can pull all seven records but I need more information from the
other tables that is related to the instock table.

-SELECT instock.instockID,  instock.materialCode, instock.treatmentCode,
instock.bulkCode, instock.shapeCode, instock.calibrate, instock.price,
-material.materialName, material.sDiscription, material.matImage1
-
-FROM instock, material
-
-WHERE instock.materialCode =  'colname' AND
-instock.materialCode = material.materialCode AND
-instock.shapeCode = shape.shapeCode
-
-ORDER BY instock.shapeCode ASC

Could someone help me and show me an other way in writting the top queries.

Thanks,

David



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux