Append records from one table to another using the common field
There are many varied posts about this matter, but I am unable to find the answer I need. I am hoping this question is unique.
I am trying to append all the data from one table to another, without creating new records. The data in the second table is really a subset of data for a portion of the existing records in the first table.
For example: I have the table "SPK". And I want to write all of the data from SPK into the table "RCT". The common field between each record I want to match is the RegID, which is unique in both tables (i.e. there is only one SPK record per RCT record).
If I understand correctly, you mean append the columns in one table (call it SECOND) to the other (call it FIRST).
In that case, does this work ?
UPDATE regcontactsTest JOIN speakersTest ON speakersTest.RegistrationID = regcontactsTest.RegistrationID SET regcontactsTest.presentationtitle = speakersTest.presentationtitle
EDIT: Updated the query based on Mariadb syntax
You need to use JOIN. For general Update join :
update tab1 a join tab2 b ON a.join_colA = b.join_colB SET a.columnToUpdate = [something]
Or in other words:
update tab1 a join tab2 b on .. set a.field=...;