您好。我刚学会了如何选择所有相关数据,比如行 tennismatch.ID = 1:
SELECT * FROM tennismatch m
JOIN tennismatch_tennisset ms
ON m.`ID` = ms.`TennisMatch_ID`
JOIN tennisset s
ON ms.`mapOfSets_ID` = s.`ID`
JOIN tennisset_game sg
ON s.`ID` = sg.`TennisSet_ID`
JOIN game g
ON sg.`gamesMap_ID` = g.`ID`
JOIN game_point gp
ON g.`ID` =gp.`Game_ID`
JOIN point p
ON gp.`points_ID` = p.`ID`
WHERE m.`ID` = 1
但我无法想象如何删除它。 非常感谢。
答案 0 :(得分:1)
使用DELETE JOIN语句
DELETE m, s, g, p, ms, sg, gp
FROM tennismatch m
JOIN tennismatch_tennisset ms ON m.ID = ms.TennisMatch_ID
JOIN tennisset s ON ms.mapOfSets_ID = s.ID
JOIN tennisset_game sg ON s.ID = sg.TennisSet_ID
JOIN game g ON sg.gamesMap_ID = g.ID
JOIN game_point gp ON g.ID = gp.Game_ID
JOIN point p ON gp.points_ID = p.ID
WHERE m.ID = 1