Advertisement:

Author Topic: Help with UPDATE TABLE  (Read 291 times)

Offline skb

  • Jr. Member
  • **
  • Posts: 382
    • Metabolically Challenged
Help with UPDATE TABLE
« on: February 05, 2020, 11:50:10 PM »
I need to update a table into my new database from an older database. Inserting the old records should be fine, if the newer records also remain intact.
I've tried various permutations and combination with the UPDATE TABLE command but keep running into syntax errors, as I am a total nerd.

Can someone please guide me.
Learning, every day.
Forum - Diabetes Forum
Because every diabetic needs help
SMF 2.1 RC2 (default theme) / TP 1.6.2

Offline d3vcho();

  • Sempiterno
  • Lead Localizer
  • SMF Hero
  • *
  • Posts: 4,179
  • Gender: Male
    • frandominguez03 on GitHub
Re: Help with UPDATE TABLE
« Reply #1 on: February 06, 2020, 03:26:30 AM »
Tell us how are you trying to do it, so we can tell you what's wrong.

"Greeting Death as an old friend, they departed this life as equals."

Offline skb

  • Jr. Member
  • **
  • Posts: 382
    • Metabolically Challenged
Re: Help with UPDATE TABLE
« Reply #2 on: February 06, 2020, 06:09:09 AM »
Through PhPMyadmin on my Wamp local setup.

I finally got it with this command;

Quote
INSERT INTO dbxxx.smf_tablename SELECT * FROM dbyyy.smf_tablename;

But not before working around a Duplicate Entry for Primary Key error with this;

Quote
SET foreign_key_checks = 0;
TRUNCATE `tablename`;
SET foreign_key_checks = 1;
Learning, every day.
Forum - Diabetes Forum
Because every diabetic needs help
SMF 2.1 RC2 (default theme) / TP 1.6.2