Topic: How to find max id and to write down in 2 tables?
Respected , Akina with coming new year! Does not give rest a question as it is possible to find max_id from the table subject and to copy it in the table person, it is desirable the general-purpose method which would allow to interpose at once into 2-3 tables the same max id. There is such request:
"INSERT INTO person (max_id, iin, surname, name)
SELECT iin, surname, name
WHERE iin IN (
SELECT xml_person.iin FROM xml_person
LEFT JOIN person ON (xml_person.iin=person.iin) WHERE person.iin IS NULL AND xml_person.done=0)
The table subject: