Skip navigation links

MySQL Forums :: Performance :: Update Statement To Not Use A Subquery


Advanced Search

Update Statement To Not Use A Subquery
Posted by: Justin Keller ()
Date: November 13, 2009 05:47PM

I have the following:

UPDATE transactions SET out_id = 50, project_id = 100 WHERE id = (SELECT transaction_id FROM users_current_transaction WHERE user_id = 1);

Reading from Google it appears the use of correlated sub-queries is VERY naughty because of performance reasons. How would I rewrite the above to not use a sub-query for the update? Thanks.



Edited 1 time(s). Last edit at 11/13/2009 05:52PM by Justin Keller.

Options: ReplyQuote


Subject Views Written By Posted
Update Statement To Not Use A Subquery 181 Justin Keller 11/13/2009 05:47PM
Re: Update Statement To Not Use A Subquery 74 Justin Keller 11/15/2009 11:51PM
Re: Update Statement To Not Use A Subquery 62 Rick James 11/18/2009 09:29PM


Sorry, only registered users may post in this forum.