This is a discussion on Update Subquery Help within the MySQL Database forums, part of the Database Forums category; Hi there. I'm in need of assistance with an update query. I am doing a data migration for a ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi there. I'm in need of assistance with an update query. I am doing
a data migration for a message board. All went fine except some of the mappings didn't cross over. Here is what I need to do: Tables: Thread: threadid, firstpostid, lastpostid Post: postid, threadid, dateline I need to map the first post from post.postid to thread.firstpostid and the last post from post.postid to thread.lastpost id. I can get these values by two queries if I know the threadid First Post = select postid, threadid from post where post.threadid = 1 order by FROM_UNIXTIME(dateline) asc limit 1 Last Post = select postid, threadid from post where post.threadid = 1 order by FROM_UNIXTIME(dateline) desc limit 1 Does anyone know how I can seamlesly update the Thread table with these post id's respectively through one subquery? I am using MySQL 5.x Thanks in advance |
|
|||
|
Do not multi-post. Cross-post if you must but don't multi post It waste's people's time. http://www.blakjak.demon.co.uk/mul_crss.htm |