Delete From 带 inner join
Delete from Table From Table inner join TableOther On Table.Id=TableOther.Id
注意上面是两个From
View Code
Declare @rowCount int Declare @SQL nvarchar(1000) set @rowCount=0 Set @SQL='' select @RowCount=count(1) from KB_Lable_IsScanSync where IsSync=1 Set @rowcount=cast( (@RowCount * 2) /3 as int) Set @SQL=' Delete From KB_Lable_IsScanSync From KB_Lable_IsScanSync s inner join ( select top '+ cast(@rowCount as nvarchar(50))+' RecId from KB_Lable_IsScanSync where IsSync=1 order by RecId ) as t on t.RecId=s.RecId ' Exec(@SQL)