I have 2 tables with identical structures, and the last column is "updated". Column "updated" is
timestamp on update CURRENT_TIMESTAMP.
tableB collects "flagged" data submitted from users, for a moderator to review before moving it to tableA (if approved).
Here's the code I currently use:
@var_user = 'whatever';
REPLACE INTO tableA
SELECT * FROM tableB
WHERE username=@var_user
LIMIT 1;
Can you guys suggest how I might change it to only REPLACE if tableB.updated is newer than tableA.updated? Keeping in mind that tableA.updated may not exist at all.
TIA!