select* from dbo.Attendence where LectureID in (select LectureID from [Lecture] where courseid=121)
select* from Attendencejoin [Lecture] on [Lecture].LectureID=Attendence.LectureIDjoin Course on Course.CourseID=[Lecture].CourseIDwhere Course.courseid=121
----
ALTER
@CourseID
PROCEDURE [dbo].[DeleteCourse]int
AS
BEGIN
SET NOCOUNT ON;
delete from dbo.Attendence where LectureID in (select LectureID from [Lecture] where courseid=@CourseID)
delete from [Lecture] where courseid=@CourseIDdelete from dbo.Course where courseid=@CourseID
END