select t1.name, t2.name from messages left join Users as t1 on mesagges.From = t1.UserID left join Users as t2 on messages.To = t2.UserID;
Jonas Jonsson wrote: > > Hi > > I have a table named Messages > It looks like this > > Message From To > > Exampel 1 2 > > And I also have a table named Users, A short version of it looks like this > > UserID UserName > 1 Me > 2 You > > Now to the problem > > I want to do a Select from Messages like this > > SELECT * FROM Messages; > > And the fields From and To shall be replaced with the name from the User table > > For exampel > > When I have done the select it should return > > Message From To > Exampel Me You > > I have tryed to think this out but all I have come up with is that I only receive >one of the names and not the other > > I hop some of you out there know better then me :) > > /Jonas > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php