This resembles what I want to do:
SELECT TextTable.eid AS eid , UNIX_TIMESTAMP(TextTable.CreationDateTime) AS CreationDateTime, TextTable.transprofid AS transprofid, TextTable.fromprofid AS , TextTable.toprofid AS toprofid , TextTable.subject AS subject , TextTable.MessageOrig AS MessageOrig , TextTable.MessageTran AS MessageTran , TextTable.Status AS Status , TextTable.TransStatus AS TransStatus , p1.username AS tousername , p2.username AS fromusername
FROM `TextTable` , `profiles` AS p1, profiles AS p2
LEFT JOIN profiles ON p1.ProfID = TextTable.toprofid AND p2.ProfID = TextTable.fromprofid
WHERE (TextTable.toprofid = '".$_SESSION['ProfID']."' OR TextTable.transprofid = '".$_SESSION['ProfID']."' ) AND `TextTable.Status` = 'New' OR `TextTable.TransStatus` = 'New'
LIMIT 10";
Am I waisting my time trying to relate with p1 and p2 and doing the JOIN?
Thanks