-1

这个查询有什么问题?它说:在 ' 附近使用的语法INNER JOIN cm_competitions ON cm_matches.competition_id = cm_competitions.compet 在这有什么问题?

$query_matches = "SELECT cm_matches.match_id, cm_competitions.name 
                   INNER JOIN cm_competitions.name 
                   ON cm_matches.competition_id = cm_competitions.competition_id 
                    FROM cm_matches 
                    WHERE cm_matches.club_h_id = 8 
                   OR cm_matches.club_v_id = 8";
4

4 回答 4

0

你放在FROM cm_matchesafter INNER JOINwhich 应该是 before INNER JOIN。所以试试这个查询:

SELECT cm_matches.match_id, cm_competitions.name 
  FROM cm_matches
 INNER JOIN cm_competitions 
    ON cm_matches.competition_id = cm_competitions.competition_id
 WHERE cm_matches.club_h_id = 8 
    OR cm_matches.club_v_id = 8
于 2013-07-23T08:25:42.157 回答
0

在FROM标记后使用INNER JOIN :

$query_matches = "SELECT cm_matches.match_id, cm_competitions.name  
                  FROM cm_matches 
                  INNER JOIN cm_competitions 
                  ON cm_matches.competition_id = cm_competitions.competition_id
                  WHERE cm_matches.club_h_id = 8 
                  OR cm_matches.club_v_id = 8";
于 2013-07-23T08:25:55.147 回答
-1

尝试 :

$query_matches = "SELECT cm_matches.match_id, cm_competitions.name FROM cm_matches INNER JOIN cm_competitions ON cm_matches.competition_id = cm_competitions.competition_id  WHERE cm_matches.club_h_id = 8 OR cm_matches.club_v_id = 8";
于 2013-07-23T08:26:52.030 回答
-2

您的查询应该是这样的:

$query_matches = "SELECT cm_matches.match_id, cm_competitions.name FROM cm_matches INNER JOIN cm_competitions ON cm_matches.competition_id = cm_competitions.competition_id WHERE cm_matches.club_h_id = 8 OR cm_matches.club_v_id = 8";
于 2013-07-23T08:27:24.170 回答