MySQL, Why doesn't my update query work?
I'm made a copy of my MySQL database in MS Access as I was开发者_开发技巧 sure my query would work.
Heres my query
UPDATE Pads RIGHT JOIN Fix ON Pads.PadID = Fix.PadID
SET Pads.RemoveMeDate = '1999-01-01 00:00:00'
This query work in MS Access, but not in MySQL.
How do I fix this ? and why doesn't it work ?
EDIT * When I say my query doesn't work, I mean no rows affected, when there are matching records ... *
I don't see a need for that join? Try something like this:
UPDATE Pads
SET Pads.RemoveMeDate = '1999-01-01 00:00:00'
WHERE Pards.PadId IN (
SELECT PadId FROM Fix
)
UPDATE Pads, Fix SET Pads.RemoveMeDate = '1999-01-01 00:00:00' WHERE Pads.PadID = Fix.PadID
or solution above / below from Nanne depending what is a reason for JOIN
Try putting Pads.PadID = Fix.PadID
in parenthesis
(Pads.PadID = Fix.PadID)
I've never actually tried doing a join on an update query, so I'm not sure if that will work.
精彩评论