SQL Moving Data Between Many Tables
On moving data between tables:
This is a problem I have where I want to move a record from an 'enquirer' table into a 'student' table, and then add their course interests from the old 'enquirer interests table' into the new 'student interests' table.
In other words, I want to take a record from the enquirer table and pass this into the student table, whereby the enquirer becomes a student, and a new id for this student will be an auto incremented number. After this, I want to take the enquirer's (who has become a student) interests from the 'enquirer interests' table and place these interests into the 'student interest's' table, and the interests will be linked to the new id which was generated when the enquirer became a student.
So far, I can pass the enquirers details into the student table, no problem. But how do i pass the interests from the enquirer interests table into the students interests table using the new incremented id that uniquely identified the student?
I know sometimes people just select last id in the student table, but this is not recommended. Is there another way to link the students interests to the new student id?
Thanks in advance:cool:,