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 Link to comment https://forums.phpfreaks.com/topic/103834-problem-with-update-query/ 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". Link to comment https://forums.phpfreaks.com/topic/103834-problem-with-update-query/#findComment-531669 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? Link to comment https://forums.phpfreaks.com/topic/103834-problem-with-update-query/#findComment-531759 Share on other sites More sharing options...
fenway Posted May 2, 2008 Share Posted May 2, 2008 You can read more about this here... Link to comment https://forums.phpfreaks.com/topic/103834-problem-with-update-query/#findComment-531789 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.