Sesuatu seperti ini akan berhasil, meskipun kueri dalam mungkin perlu dimodifikasi sedikit.
SELECT table1.*, table2.*
FROM table1
INNER JOIN
(
SELECT *
FROM table2
WHERE user = 23 or friend = 23
)
AS table2 ON table1.user = table2.user;