我收到一条错误消息,指出关键字INNER附近的语法不正确。我希望从语句中包含的所有表中删除,因为它们都是与表Session相关的约束。
DELETE FROM Session INNER JOIN
Booking ON Session.SessionID = Booking.SessionID INNER JOIN
BookingChild ON Booking.BookingID = BookingChild.BookingID INNER JOIN
Reservations ON Session.SessionID = Reservations.SessionID INNER JOIN
ReservationChild ON Reservations.ReservationID =
ReservationChild.ReservationID INNER JOIN
SessionResources ON Session.SessionID = SessionResources.SessionID
INNER
JOIN
SnackSession ON Session.SessionID = SnackSession.SessionID INNER JOIN
SessionSpeaker ON Session.SessionID = SessionSpeaker.SessionID
WHERE Session.SessionID = 8
最佳答案
您好,您必须使用CASCADE操作创建外键。之后,您只能删除第一行表,关系数据将自动删除!
祝好运!
关于mysql - 我希望从联接中包含的所有SQL表中删除,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55302042/