MySQL表连接:一个记录,两个字段,另一个表中的id

I'd like to join two tables, producing a result where the IDs in the 2nd and 3rd columns of table2 are replaced by the corresponding name values from table1:

table1:
  id - name
  ---------
  1 -  Sam
  2 -  Ben
  3 -  Nick

table2: 
id      name1           name2        upvote   downvote
1 1(id of Ben) 3(id of Nick) 150 8

So my goal here is to join these tables and produce:

1 -  Ben  -  Nick  -  150   - 8

How can I achieve this?

A simple Join is needed, See more : MySQL Joins Manual

SELECT 
table1.id,table1.name,
table2.name2,table2.upvote,
table2.downvote 
FROM `table1`
INNER JOIN `table2`
ON
table2.name2 = table1.id