[Moved by moderator to Databases forum]
hi guys!!
i m stuck here a mysql query , i have three tables,category,product,speciality.
In category colum the fields are cat_id, cat_name.
In product table prod_id,prod_name,prod_desc,cat_id(FK).
In Speciality Table i have spec_id,spec_name,prod_id(FK).
The problem is i want a list view of category,prod_name,spec_name,when i use inner join i don't get the required result , like if inner join category and product table i did get the categoy and there product but when i join the speciality table it only shows those categories, which have specialites.
The query is used for two table is select * from product inner join category where category.cat_id=product.cat_id;
Some products have speciality and some have not.
can any body tell me how to do it,
Thanks
Mysql query retreving data from three table
Moderator: General Moderators
Re: Mysql query retreving data from three table
In this case you may want to use an outer join. These links should help you on your way.
Php mysql join Tutorial.
http://www.tizag.com/mysqlTutorial/mysqljoins.php
Mysql Docs
http://dev.mysql.com/doc/refman/5.0/en/ ... ation.html
Php mysql join Tutorial.
http://www.tizag.com/mysqlTutorial/mysqljoins.php
Mysql Docs
http://dev.mysql.com/doc/refman/5.0/en/ ... ation.html