table1 tbl_ItemCreation:(itemCreation_id primary key and autogenerated)
table 2 tbl_ItemGroup(itemGroup_id primary key and autogenerated)
table 3 tbl_UnitCreation:(Unit_id primary key and autogenerated)
these are my 3 tables.and id of each table is autogenerated. i want to insert group_name,undergroup from table 2 i.e tbl_ItemGroup into table 1 i.e tbl_ItemCreation.
also unit_name from table 3 i.e tbl_UnitCreation into table 1 i.e tbl_ItemCreation.
i am confused over table 1 i.e tbl_itemCreation that should i use foreign key or not? and how.
also exactly which method to use for this.
i tried this by using joins.
it is not producing error.but not giving expected result also. m i doing wrong?
In this case, you have to get unitname, groupname of the parent tables by passing the unitid, groupid for the item.
It is preferrable to have the unitid, groupid in the itemcreation table, instead of unitname, groupname. It will avoid UPDATE anomalies in future. You have to go for Normalized design.
You are trying to use child table(itemcreation) in JOINS to insert value into child table(itemcreation) and it is not right here.
answered Apr 05, 2016 at 04:24 AM