At 3:07 PM -0500 11/29/07, Rob Marscher wrote:
On Nov 29, 2007, at 2:24 PM, tedd wrote:
The above code worked great four months ago, but now the code fails
and reports this:
You have an error in your SQL syntax near 'u1, user2 u2 SET
u1.login=u2.login, u1.password=u2.password WHERE u1.username=u2' at
line 1
Either the word "user" has become a reserved word... or it doesn't
like the table aliases now. That's my two guesses.
So try this:
UPDATE `user` u1, user2 u2
SET u1.login = u2.login, u1.password = u2.password
WHERE u1.username = u2.username
And then try this if that doesn't work:
UPDATE user, user2
SET user.login = user2.login, user.password = user2.password
WHERE user.username = user2.username
And finally this:
UPDATE `user`, user2
SET user.login = user2.login, user.password = user2.password
WHERE user.username = user2.username
Thanks -- however, I tried all of those and they didn't work.
I also changed the query to:
UPDATE user1 u1, user2 u2
SET u1.login = u2.login, u1.password = u2.password
WHERE u1.username = u2.username
and variations on that theme, but still nothing worked.
The current version of MySQL that I am forced to work with is: 3.23
I don't know what version I was using four months ago. But whatever
it was, it worked then, but not now. I'm clueless as to why it
doesn't work now, but I worked out a way around it by using a LEFT
JOIN. Besides, it did more.
Thanks very much for your time.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
_______________________________________________
New York PHP Community MySQL SIG
http://lists.nyphp.org/mailman/listinfo/mysql
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php