How to write sql query for this
**CategoryMaster**
CategoryId Category Name
1 ABC
2 Xyz
3 PQR
**Product master**
ProductId Name
1 ABCD
2 WXYZ
3 UVWX
**ProductCategory**
ProCatID ProductId 开发者_运维知识库 CategoryId
1 1 1
2 1 2
3 2 3
4 3 2
5 3 3
**ProductDetail**
ProductDetailId Price Qty Date ProductId
1 250 8 2-11-2011 1
2 200 10 2-12-2011 2
I want to featch all product detail from product master table with its category my table structure is same as above
Your ProductMaster table is not normalized. This is not good: you should model like this:
Productmaster
- productid
- name
ProductCategories:
- productid
- categoryID
精彩评论