--trydelete A from score A where exists(select 1 from student where xuehao = A.xuehao)

解决方案 »

  1.   

    delete s
    from score s,student x
    where s.xuehao=x.xuehao
      

  2.   


    declare @ta table (id int)
    insert into @ta select 1
    insert into @ta select 2
    insert into @ta select 3
    insert into @ta select 4declare @tb table (id int)
    insert into @tb select 1
    insert into @tb select 5
    insert into @tb select 3delete a from @ta a,@tb b where a.id=b.idselect * from @ta
    2
    4
      

  3.   

    declare @score table (xuehao int)
    insert into @score select 1
    insert into @score select 2
    insert into @score select 3
    insert into @score select 4declare @student table (xuehao int)
    insert into @student select 1
    insert into @student select 5
    insert into @student select 3delete a from @score a,@student b where a.xuehao=b.xuehaoselect * from @score
    2
    4
      

  4.   


    delete from score as s where xuehao in(select t.xuehao from student as t where s.xuehao=t.xuehao)