> This will give me sort of what I am looking for, but it shows the
> UserKey in the first column and I want the UserID.  I have tried a few
> others but just got errors.

> SELECT f.UserKey, UserID FriendID, Name FriendName
> FROM User u, FriendList f
> WHERE f.FriendKey = u.UserKey
> ORDER BY f.UserKey, FriendID;

You need to join user to friendlist twice.  Try this (I don't have time to test it 
now, but it should work):

SELECT u1.UserID UserID, u2.UserID FriendID, u2.Name FriendName
FROM User u1, User u2, FriendList f
WHERE f.UserKey = u1.UserKey AND f.FriendKey = u2.UserKey
ORDER BY UserID, FriendID;



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to