这个查询有什么问题?它说:在' 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";
你把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
在 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";
尝试:
$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";
您的查询应该是这样的:
$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";