RE: Spot the deliberate mistake...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Mark Benson [mailto:markbenson@xxxxxxx] 
> If I try that it returns:

> You have an error in your SQL syntax near 'ON DUPLICATE KEY UPDATE' at
line 1

> so I guess something doesn't work there. I also tried it with and
without the line ending and it didn't work either way :).

Are you running a version of mysql >= 4.1.0 ?

"If you specify the ON DUPLICATE KEY UPDATE clause (new in MySQL 4.1.0),
and a row is inserted that would cause a duplicate value in a UNIQUE
index or PRIMARY KEY, an UPDATE of the old row is performed."

http://dev.mysql.com/doc/mysql/en/INSERT.html

Also, note - I was VERY WRONG!  You are allowed to follow the statement
with what you want updated - and I believe you're supposed to.  I
knee-jerked that first answer, assuming it must be it since the
information was so redundant - my apologies.  I expect, however, that
you're not supposed to specify the key again with the update part,
though I suppose it's possible to.

Cheers,
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux