GameboyRMH
GameboyRMH GRM+ Memberand Dork
9/15/08 2:01 p.m.

Gives a syntax error (1064):

UPDATE contacts SET contacts.date_entered=contacts_old.date_entered FROM contacts INNER JOIN contacts_old ON contacts.id=contacts_old.id;

Works fine:

SELECT contacts.id, contacts_old.id FROM contacts INNER JOIN contacts_old ON contacts.id=contacts_old.id;

This is driving me nuts!

MySQL 5045

GameboyRMH
GameboyRMH GRM+ Memberand Dork
9/15/08 2:07 p.m.

Got the job done using an UPDATE-WHERE query:

UPDATE contacts, contacts_old SET contacts.date_entered=contacts_old.date_entered WHERE contacts.id=contacts_old.id;

I'd still like to know why the UPDATE-FROM-JOIN query doesn't work

Dr. Hess
Dr. Hess SuperDork
9/15/08 2:11 p.m.

I deal mainly with SQL Server 2K. I have poked around just a tiny bit with MYSQL and I ran into your exact problem. It appears that, as usual, Microsoft has developed their own flavor of SQL that is just different enough that other people's stuff won't work. The Update clause is one of those places. I, too, usually use an update from clause like your first one. I had to use the version like your second statement to get it to work with that mysql database.

You'll need to log in to post.

Our Preferred Partners
6e3pzpqs5ZTmPtQlLWZaLxUZsNtGY3gJt3oOrLOZMxyWwruddmgqAiHa7mAyH1Ne