Code: Select all
$r=mysql_query("
(
SELECT *
FROM commentsvv AS dt
WHERE FIND_IN_SET(id,'$dset')>0
AND id2='$uid'
AND status_id2='0'
ORDER BY datetimep DESC LIMIT 1)
UNION
(
SELECT *
FROM commentsvv AS dt
WHERE FIND_IN_SET(id2,'$dsetv')>0
AND id='$uid'
AND status_id='0'
ORDER BY datetimep DESC LIMIT 1)
");Table structure with rows in it:

What I am after is the last conversation in between the logged in user and any other user. Last row which holds in the longtext the conversation and it's timestamp and whether the sender was the logged in user or the other party, etc.