开发者

How to write sql query for this

开发者 https://www.devze.com 2023-02-20 18:15 出处:网络
**CategoryMaster** CategoryId Category Name 1ABC 2Xyz 3PQR **Product master** ProductIdName 1ABCD 2WXYZ 3UVWX **ProductCategory**
**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

精彩评论

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

关注公众号