DEV Community

Akash Chawan
Akash Chawan

Posted on

How to join tables data already exist in table

getting below error

[Nest] 15320 - 18/06/2024, 9:48:15 pm ERROR [ExceptionHandler] Cannot add or update a child row: a foreign key constraint fails (shipping.#sql-220c_403, CONSTRAINT FK_ce723b9c7f1fbc4a9a1cf4d8865 FOREIGN KEY (present_rank) REFERENCES rank (id) ON DELETE NO ACTION ON UPDATE NO ACTION)
QueryFailedError: Cannot add or update a child row: a foreign key constraint fails (shipping.#sql-220c_403, CONSTRAINT FK_ce723b9c7f1fbc4a9a1cf4d8865 FOREIGN KEY (present_rank) REFERENCES rank (id) ON DELETE NO ACTION ON UPDATE NO ACTION)

@Column()
present_rank: string;

@OneToOne(() => Rank,rank=>rank.id)
@JoinColumn({ name: 'present_rank' })
rank: Rank;
Enter fullscreen mode Exit fullscreen mode

Top comments (0)