Reputation: 33
tables are here :
i want to write ;
match 1: jonathan vs jenny ,
match 2: sam vs ruby,
match 3: arif vs pamee
I tried lots of queries but failed to accomplish it.
SELECT table1.boy_id, table1.girl_id, table1.ID, table2.id, table2.name, table2.score
FROM table1
INNER JOIN table2
Upvotes: 0
Views: 36
Reputation: 263703
SELECT a.ID,
b.name BoyName,
c.name GirlName
FROM table1 a
INNER JOIN table2 b
On a.boy_id = b.id
INNER JOIN table2 c
ON a.girl_id = c.id
You need to join table2
twice on table1
since there are two columns from table1
that references to table2
.
Upvotes: 2