2014-10-18 77 views
0

我有3个表Categorysubcategoryproduct全外连接(SQL)

我该怎么办全外,这些表之间,但是,69年1月5日的版本(MySQL的)

[category.cat_id] => category table l 
[subcategory.subcat_id] => subcategory tab1e 2 
[product.subcat_id] => product table 3 
+0

对不起[联盟]上的版本69年1月5日 – user3536155 2014-10-18 08:10:27

+0

不工作,你说你的版本是:版本69年1月5日,它已经在那里工作!再次检查..错误是什么? 附上您的查询和错误。 – billoo 2014-10-18 08:11:08

回答

0

有CAT_ID加盟作为Subcategory表中的外键和subcat_id作为product表中的外键。

这里有一个例子内连接:

Select product_name,cat_name,subcat_name 
from Product p,Category c,Subcategory s 
where c.cat_id=s.cat_id and p.subcat_id=s.subcat_id and product_id=121