I created these two tables:
CREATE TABLE `Game` (
`GameName` varchar(30) NOT NULL,
`GameGenre` varchar(20) NOT NULL,
`GameDescription` varchar(500) NOT NULL,
`GameMode` varchar(20) NOT NULL,
PRIMARY KEY (`GameName`)
) ENGINE=InnoDB;
CREATE TABLE `GameScoreTotal` (
`ScoreID` int(3) NOT NULL AUTO_INCREMENT,
`GameName` varchar(30) NOT NULL,
`OverallScoreTotal` mediumint(9) NOT NULL,
`GraphicsTotal` mediumint(9) NOT NULL,
`StoryTotal` mediumint(9) NOT NULL,
`GameplayTotal` mediumint(9) NOT NULL,
`TimeTotal` mediumint(9) NOT NULL,
PRIMARY KEY (`ScoreID`),
CONSTRAINT FOREIGN KEY (`GameName`) REFERENCES `Game` (`GameName`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;
我的问询需要从基于<条码”的十大比赛桌上收回所有信息。 HolScore Total.OverallScore Total 。
我曾尝试过问:
SELECT GameName
FROM Game
FULL JOIN GameScoreTotal
ON Game.GameName=GameScoreTotal.GameName
ORDER BY OverallScoreTotal DESC
LIMIT 0, 10;
SELECT Game.GameName
FROM Game
FULL JOIN GameScoreTotal
ON Game.GameName=GameScoreTotal.GameName
ORDER BY OverallScoreTotal DESC
LIMIT 0, 10;
Both tables have legitimate records within them.