Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 
Read only

SALES HEADER TABLE

Former Member
0 Likes
893

Hi,

I need to place  a sales order for customers buying a product. But the thing is if a customer buys more than 1 product different sales order is created for other products. What I need is if a customer buys more than 1 product it should come under the same sale order.

I need the possible fields to be put into the table because i have added sales_id field as Primary key and so if I add another product for a customer,obviously different sales_id is created.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
641

Hi,

According to my knowledge, If I got your requirement properly, your requirement is met by normalization.

In that first table is as Customer header   Second   is  Sales Orders   and third is for  Products.

Customer_id  is primary key for 1st table. Sales_id will be foreign key pointing to  primary key of  second table ' Sales_id'.   And  Third table  is having primary key Sales_id and Product_id   .

And Sales_id is  foreign key pointing to  Sales_id column of Second table.

When you add new record for  Second product for already present  customer in table  then  you will have to just select  the  Sales_order for that customer from first table . And you can insert new record for new Product in Third table. In his way data duplication is avoided.

Thanks

Santosh.

2 REPLIES 2
Read only

Former Member
0 Likes
642

Hi,

According to my knowledge, If I got your requirement properly, your requirement is met by normalization.

In that first table is as Customer header   Second   is  Sales Orders   and third is for  Products.

Customer_id  is primary key for 1st table. Sales_id will be foreign key pointing to  primary key of  second table ' Sales_id'.   And  Third table  is having primary key Sales_id and Product_id   .

And Sales_id is  foreign key pointing to  Sales_id column of Second table.

When you add new record for  Second product for already present  customer in table  then  you will have to just select  the  Sales_order for that customer from first table . And you can insert new record for new Product in Third table. In his way data duplication is avoided.

Thanks

Santosh.

Read only

0 Likes
641

Thanks santosh.