Diberikan dua pengguna @friend1 dan @friend2 temukan semua pengguna yang merupakan teman bersama mereka:
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
)