0

I am trying to link fields between 2 of my tables but its not working.

I have a table called assets, which consists of Asset_ID and AssetType
and a table called t5_week3_shift3 which also consists of these 2 plus others.

Im not sure whether to do away with the assets table and just have both fields in the t5_week3_shift3 table, but i have recently created the t5_week3_shift3 table and i have all asset_ID's in this table which are also in assets table but i need to asset types in this table too which relate to each asset_ID.

whats the easiest way to do this, i thought i could somehow link the two tables but it doesnt work.

if i index AssetType in assets table and try to set up a relationship to assetType in t5_week3_shift3 table i get this error:
#1452 - Cannot add or update a child row: a foreign key constraint fails (`chs`.`#sql-9b0_59`, CONSTRAINT `#sql-9b0_59_ibfk_1` FOREIGN KEY (`AssetType`) REFERENCES `t5_week3_shift3` (`AssetType`))

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by smantscheff
0

Are you perhaps using MyIsam tables ? Another reason could be (which I encountered myself recently) that your webhost has that option turned off.

0

Most probably your child table contains values which are not in the master table. Check that all asset_type values of the child occur in the master.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.