开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜