Select a.name as user1, b.name as user2 from $table_user a ,$table_user b ,$table_match c where a.user_id = c.user_id1 and b.user_id = c.user_id2