Questo è sicuramente possibile con MySQL, ma penso che potresti affrontarlo in un modo imbarazzante. Inizierei strutturando le tabelle come segue:
TABLE Users ( userId, username, location )
TABLE Interests( interestId, hobby )
TABLE UserInterests( userId, interestId, level )
Quando un utente aggiunge un interesse, se non è stato aggiunto prima, lo aggiungi a Interests tabella, quindi aggiungerla a UserInterests tavolo. Quando vuoi cercare altre persone vicine con interessi simili, puoi semplicemente interrogare UserInterests tabella per altre persone che hanno interessi simili, che ha già tutte queste informazioni per te:
SELECT DISTINCT userId
FROM UserInterests
WHERE interestId IN (
SELECT interestId
FROM UserInterests
WHERE userId = $JoesID
)
Questo probabilmente può essere fatto in modo più elegante senza subquery, ma è quello a cui ho pensato ora.