Jump to content

Problem with update query


SyncViews

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.