Mysql query retreving data from three table
Posted: Sun Mar 29, 2009 11:52 am
[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
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