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

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -