sql - Order Tables Schema Issue -


i have 2 tables order_primary , order_complete problem when want generate bill there multiple products in bill in order_primary table, generate orderid each single product though same bill, how should associate these orderid in order_complete table there multiple orderids same product there has 1 billno

order_primary

orderid (primary key)
productid (foreign key)
categoryid (foreign key)
quantity
cost
employeeid (foreign key)

order_complete

billno (primary key)
orderid (foreign key)
date

to desired result have change data-structure this:

product_group (add new table)

productid (foreign key) productgroupid productgroupid+productid (primary key) 

order_primary

orderid (primary key) productgroupid  ^(now here productgroupid list of products(multiple)) categoryid (foreign key) quantity  cost  employeeid (foreign key) 

order_complete

billno (primary key) orderid (foreign key) date 

Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -