如何组合这两个内部联接查询

时间:2016-12-09 06:57:15

标签: mysql

如何组合这两个查询?

SELECT characters.name Name,characters.image Image,matchups.char1wins Char1Wins,matchups.char2wins Char2wins,matchups.draws Draws
FROM characters INNER JOIN matchups
ON (char1=6 ) WHERE (  characters.ID = matchups.char2 )

SELECT characters.name Name,characters.image Image,matchups.char1wins Char1Wins,matchups.char2wins Char2wins,matchups.draws Draws
FROM characters INNER JOIN matchups
ON (char2=6) WHERE ( characters.ID = matchups.char1 )

4 个答案:

答案 0 :(得分:0)

Select characters.name Name,characters.image Image,matchups.char1wins 
       Char1Wins,matchups.char2wins Char2wins,matchups.draws Draws
From characters 
Inner Join matchups On (char1=6 ) And (char2=6) 
Where (characters.ID = matchups.char2)

答案 1 :(得分:0)

SELECT characters.name Name,characters.image Image,matchups.char1wins Char1Wins,matchups.char2wins Char2wins,matchups.draws Draws
FROM characters INNER JOIN matchups
ON (table1.common_field=table.common field) WHERE (  characters.ID = matchups.char2 OR characters.ID = matchups.char1 )

答案 2 :(得分:0)

ZonedDateTime

答案 3 :(得分:-1)

    SELECT column_name(s)
      FROM table1
INNER JOIN table2
        ON table1.column_name=table2.column_name;