SyncViews Posted May 2, 2008 Share Posted May 2, 2008 I don't see why this shouldn't work... UPDATE forums SET topics=topics+1, posts=posts+1, last_topic_name='Test topic...', last_topic_id=14, last_post_id=19, last_post_time=1209662581, last_user_id=1, last_user_name='SyncViews' WHERE forum_id IN ( SELECT parent.forum_id FROM forums AS forum, forums AS parent WHERE forum.left BETWEEN parent.left AND parent.right AND forum.forum_id = 5 ) #1093 - You can't specify target table 'forums' for update in FROM clause Quote Link to comment Share on other sites More sharing options...
fenway Posted May 2, 2008 Share Posted May 2, 2008 That's a limitation on update a table from "itself". Quote Link to comment Share on other sites More sharing options...
SyncViews Posted May 2, 2008 Author Share Posted May 2, 2008 So is there anyway I can get around it without having to make 1 query to get the forums list, make the results comma seperated and insert them into a second query? EDIT: Seeing as mysql now has stored procedures is there an easy way to use them to do this? Quote Link to comment Share on other sites More sharing options...
fenway Posted May 2, 2008 Share Posted May 2, 2008 You can read more about this here... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.