Welcome to WebmasterWorld Guest from 126.96.36.199
Forum Moderators: open
SELECT * FROM (SELECT thread, MAX(id) AS id FROM messages GROUP BY thread) t1 INNER JOIN messages t2 ON t2.thread=t1.thread AND t1.id=t2.id WHERE tome = '$userid' AND INDELETE !='y' ORDER BY t1.id DESC
My problem is I need to pull out the fields "firstname", "lastname" and "image1" of the user sending the message to the person from the table "users" where the field "fromme" in the messages table is = to the "id" field in the users table. Any ideas? THANKS! JC
Maybe something like this would do the trick?
FROM ( SELECT thread, MAX(id) AS id FROM messages GROUP BY thread ) AS t1
messages AS t2 ON t2.thread=t1.thread AND t1.id=t2.id
users AS t3 ON t3.id=t1.fromme
WHERE tome = '$userid' AND INDELETE !='y'
ORDER BY t1.id DESC
Kind of hard to tell because I'm not really sure what's going on with the current temporary table and inner join. But, hopefully this will point you in a direction if you haven't already sorted this out. :)