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++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -