Givet to brugere @friend1 og @friend2 find alle de brugere, der er fælles venner af dem:
SELECT user.uid
FROM user
WHERE EXISTS(
SELECT TOP 1 1
FROM Friends
WHERE Friends.fuid = @friend1 AND Friends.fapproved = 1
AND Friends.fuid2 = User.uid
)
AND EXISTS(
SELECT TOP 1 1
FROM Friends
WHERE Friends.fuid = @friend2 AND Friends.fapproved = 1
AND Friends.fuid2 = User.uid
)