这个查询有什么问题?它说:在“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";
答案 0 :(得分:0)
您在FROM cm_matches
之后放置INNER JOIN
,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
。所以试试这个查询:
{{1}}
答案 1 :(得分: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";
答案 2 :(得分:-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";
答案 3 :(得分:-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";