Which post are you trying to update the date/time on? Just the first post? If so, you need to grab the "firstpostid" in your first query also (add threads.firstpostid to your select statement). Then you need to add a second write query to update the post table using the "firstpostid" as your "postid".