PLAYER
(playerId,playerName)LEVEL
(levelId,levelName)GAME
(playerId,levelId,time)我想删除levelId = 1
上时间最长的玩家我试过
DELETE FROM PLAYER
WHERE playerId = SELECT playerId
FROM Game G
WHERE G.levelId = 1
AND G.time >= ALL(SELECT time FROM GAME
WHERE G.levelId = levelId);
这个解决方案..是不是? 还有更好的吗?
答案 0 :(得分:1)
意味着您要删除任何播放器,这意味着
DELETE FROM PLAYER WHERE playerId = any( SELECT playerId FROM Game G
WHERE G.levelId=1
AND
G.time>=ALL(SELECT time FROM GAME WHERE G.levelId=levelId));