Update Subquery Help

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
rh1200la [ Fr, 27 Juli 2007 22:14 ] [ ID #1780187 ]

Re: Update Subquery Help

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
Paul Lautman [ So, 29 Juli 2007 16:48 ] [ ID #1781377 ]
PHP » alt.php.sql » Update Subquery Help

Vorheriges Thema: php mail not working on win98
Nächstes Thema: MYSQL REORDER PRIMARY KEY