修复!抱歉浪费任何时间:P
我试图在PHP中使用mysql加入两个colums
$result = $link->query('SELECT Software.*, Genre.Naam AS Genre, Console.Naam AS ConsoleNaam, Draager.Naam AS MediumNaam, Studio.Naam AS StudioNaam, Publisher.Naam AS PublisherNaam FROM Software INNER JOIN Genre ON Genre.Genre_ID = Software.Genre_ID INNER JOIN Console ON Console.Console_ID = Software.Console_ID INNER JOIN Draager ON Draager.Draager_ID = Software.Medium_ID INNER JOIN Company AS Studio ON Software.Studio_ID = Studio.Company_ID INNER JOIN Company AS Publisher ON Software.Publisher_ID = Publisher.Company_ID ');
Table Company必须加入Table Software才能获得ID 公司名称。
有关我必须更改为上述脚本以获取内容的任何提示 工作?
答案 0 :(得分:1)
你有一个错字。 JOIN
拼写错误为JION
:
$result = $link->query('SELECT Software.*,
Genre.Naam AS Genre,
Console.Naam AS ConsoleNaam,
Draager.Naam AS MediumNaam,
Studio.Naam AS StudioNaam,
Publisher.Naam AS PublisherNaam
FROM Software
INNER JOIN Genre ON Genre.Genre_ID = Software.Genre_ID
INNER JOIN Console ON Console.Console_ID = Software.Console_ID
INNER JOIN Draager ON Draager.Draager_ID = Software.Medium_ID
/* Misspelled JOIN below *(/
INNER JOIN Company AS Studio ON Software.Studio_ID = Studio.Company_ID
INNER JOIN Company AS Publisher ON Software.Publisher_ID = Publisher.Company_ID
');
答案 1 :(得分:1)
得到答案:
JION在关联表时拼写为JOIN:D
$result = $link->query('SELECT Software.*,
Genre.Naam AS Genre,
Console.Naam AS ConsoleNaam,
Draager.Naam AS MediumNaam,
Studio.Naam AS StudioNaam,
Publisher.Naam AS PublisherNaam
FROM Software
INNER JOIN Genre ON Genre.Genre_ID = Software.Genre_ID
INNER JOIN Console ON Console.Console_ID = Software.Console_ID
INNER JOIN Draager ON Draager.Draager_ID = Software.Medium_ID
INNER JOIN Company AS Studio ON Software.Studio_ID = Studio.Company_ID
INNER JOIN Company AS Publisher ON Software.Publisher_ID = Publisher.Company_ID
');