Forum Moderators: coopster

Message Too Old, No Replies

MYSQL confusion

When should I use a GROUP and HOW do you use aliases

         

HeadBut

2:02 am on Aug 10, 2005 (gmt 0)

10+ Year Member



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

coopster

12:18 am on Aug 12, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member




This resembles what I want to do

... and I don't get it ;)

Can you offer in plain terms what you want to accomplish, or perhaps some examples of data? Something like, I want to join the users to their messages, etc. and show some small examples of how the tables are structured.