i was trying add foreign key to existing table n with a reference to other table which is a primary key in the other table i don't understand why error is coming
Code:
ALTER TABLE pp_invoice add CONSTRAINT fk_porderno FOREIGN KEY (pp_invoice_porderno) REFERENCES pp_purchaseorder(pp_po_no)
error
"Cannot add or update a child row: a foreign key constraint fails (`ppmcsdatabase`.<result 2 when explaining filename '#sql-a48_1809'>, CONSTRAINT `fk_porderno` FOREIGN KEY (`pp_invoice_porderno`) REFERENCES `pp_purchaseorder` (`pp_po_no`))"
plzzzz help meee