I'm using the statement insert into Oscar.MenuItem (idMenuItem, name, description, price, idCategory, code, sortIndex) select * from menItem;
The result is:
Error: Cannot add or update a child row: a foreign key constraint fails (`Oscar`.`MenuItem`, CONSTRAINT `fk_MenuItem_Category1` FOREIGN KEY (`idCategory`) REFERENCES `Category` (`idCategory`) ON DELETE NO ACTION ON UPDATE NO ACTION)
SQLState: 23000
ErrorCode: 1452
Please any1 with a solution to this help me.
my tables are as follows (Table MenuItem and Table Category)
Table MenuItem
idMenuItem INT NOT NULL AUTO INCREMENT
name VARCHAR(255)NOT NULL
description VARCHAR(512) NOT NULL
price DECIMAL(10) NOT NULL
idCategory INT NOT NULL
code VARCHAR(45) NOT NULL
sortIndex INT NOT NULL
Table Category
idCategory INT NOT NULL AUTO INCREMENT
name VARCHAR(255) NOT NULL
description VARCHAR(255) NOT NULL
idMenu INT NOT NULL
sortIndex INT NOT NULL