Ok, maybe I am missing something.... if I use the statement below with the data in the table on your first post, and a table that has a username and a picture I get the following:
1 SELECT y.Friend, p.picture
2 FROM (SELECT CASE WHEN x.user1 <> @username THEN x.user1 WHEN x.user2 <> @username THEN x.user2 ELSE 'n/a' END AS Friend
3 FROM (SELECT id, user1, user2, status
4 FROM Table1
5 WHERE (status = 'approved') AND (user1 = @username) OR
6 (status = 'approved') AND (user2 = @username)) AS x) AS y INNER JOIN
7 Table2 AS p ON p.username = y.Friend
If I query for John I get
Lucie, LuciePicture
Michael, MichaelPicture
If I query for Lucie I get
John, johnpicture
michael is not shown because it is not_approved
If I query for Michael I get
John, johnpicturre
Lucie is not shown because it is not_approved
If I change the Michael/Lucie record to approved then
If I query for John I get the same result as above
if I query for Licie I get
Michael, MichaelPicture
John, JohnPicture
If I query for Michael I get
John, JohnPicture
Lucie, LuciePicture.
Which to me is the correct behavior... but like i said, maybe I am missing something... 