ā2012 Jul 16 8:44 AM
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.
ā2012 Jul 16 12:44 PM
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.
ā2012 Jul 16 12:44 PM
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.
ā2012 Jul 16 12:48 PM