Hi, I am having problems with the JOIN function.
MESSAGES memberID_1, memberID_2, Message
MEMBERS id, name
I can only manage to replace the "memberID_1" in MESSAGES with the "name" in MEMBERS, I can not replace both memberID_1 and memberID_2 with "name".
Please can someone tell me what I should be looking for in the help documents. -- David Scott
You need a join for each lookup. Something like:
SELECT mem1.name, mem2.name, mess.Message FROM messages mess JOIN members mem1 ON mess.memberID_1 = mem1.id JOIN members mem2 ON mess.memberID_2 = mem2.id WHERE ...;
If it is possible that either memberID_1 or memberID_2 is NULL, or doesn't point to a valid member row, then you should replace "JOIN" with "LEFT JOIN".
Michael
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]