Theres no reason why you need multiple queries. if you want every name for user_id1 and user_id2, just add that condition clause to the join. If you are concerned of duplicate name entries in the view from the query, then add a distinct to the statement.
I'm still having a bit of a job visualizing what your problem actually is. are user_id1 and user_id2 unique values? do they both make up a composite key ? it's even more confusing in your second post with differing table and field names.
If you cannot create a view from one query between two tables, then maybe you should reconsider the design of your database for performance gain.
The following single query "should" select a distinct set of names in table user for each user_id and game_id entry in table_ranking.
SELECT DISTINCT $table_ranking.*, $table_user.name
FROM $table_ranking INNER JOIN $table_user
ON $table_ranking.user_id=$table_user.user_id OR $table_ranking.user_id=$table_ranking.game_id