Can you set the id that you have registered in the two tables to each other's columns in one SQL session?

Asked 1 years ago, Updated 1 years ago, 95 views

There are two tables.One is an item table and the other is a parts table.
There is a type of entry on the item screen where item data is registered. Only when type is "abcde" is registered in the part table and item table. Other values, only items are registered, but these two tables have their own main keys.
Is it possible to register the id of the result of registering in the item table and the part table in each table in one sql?

I'm thinking of registering the item table first, obtaining the id of the registered data, setting the item_id in the part table data, registering the part data, and finally updating the part_id of the item table. Is it possible to do this with one sql?

Item Table

Parts Table

mysql sql

2022-09-30 21:16

1 Answers

From Comments

Due to the specifications of the entity binding framework I am using, the combined models had their own keys, so I asked you this strange question.

Actually, it was implemented in js instead of SQL, and the implementation was solved by setting the item key obtained by registering the item table as a part and updating the part key to the item again.Thank you for your kind reply. - A passing man


2022-09-30 21:16

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.