DELETE FROM TEMPSchedules
WHERE StudentID = ( Select StudentID
From Students
Where Ref = 'H1007')
子查询返回的值超过1。这是不允许的 子查询跟随=,!=,<,< =,>,> =或当子查询用作 表达。
现在的问题是每个“Ref Group”都附加了1个以上的学生。那我应该怎么处理呢。 感谢
答案 0 :(得分:5)
DELETE FROM TEMPSchedules
WHERE StudentID in ( Select distinct StudentID
From Students
Where Ref = 'H1007')
答案 1 :(得分:0)
DELETE TEMPSchedules
From Students
Where Students.Ref = 'H1007' and Students.StudentID=TEMPSchedules.StudentID
答案 2 :(得分:0)
以下SQL语句仅从"" StudentID""中选择DISTINCT值。 """"""表格Ref =' H1007':
SELECT DISTINCT StudentID FROM Students;