Jump to content

How do you join two UPDATE Queries,


Aphanasiy

Recommended Posts

Is it possible to union or join two UPDATE Queries to work at the same time?

UPDATE ibf_dnames_change SET dname_previous='WizarD1' WHERE dname_previous='WizarD' JOIN UPDATE ibf_dnames_change SET dname_previous='zxcvbnm' WHERE dname_previous='coyl'/*

How do I execute these two queries together please?Thank you, please do reply, need help.

Link to comment
Share on other sites

If the WHERE condition were the same for both statements then you could combine them into one.http://dev.mysql.com/doc/refman/4.1/en/update.htmlJOIN is used for 2 different tables. You seem to be working with just one in those statements, so JOIN doesn't applyI don't understand why your statements would need to be in the same query. The aren't dependent on each other in any way. Just execute them separately.

Link to comment
Share on other sites

Guest Manju
Is it possible to union or join two UPDATE Queries to work at the same time?
UPDATE ibf_dnames_change SET dname_previous='WizarD1' WHERE dname_previous='WizarD' JOIN UPDATE ibf_dnames_change SET dname_previous='zxcvbnm' WHERE dname_previous='coyl'/*

How do I execute these two queries together please?Thank you, please do reply, need help.

Hi,It can not be done. Regards,Manju.
Link to comment
Share on other sites

UPDATE  A  SET A.FIELDNAME = "NEW VALUE"  B.FIELDNAME = "NEW VALUE" FROM TABLE1 A, TABLE B  WHERE A.ID = B.ID

That will not work you can just execute the 2 seperate queries one after another....there is no need ot combine them but if you really want to just use a strored procedure.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...