0

tables are here :

enter image description 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
4

1 回答 1

2
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

您需要加入table2两次,因为该引用中table1有两列。table1table2

于 2013-09-19T16:41:52.500 回答