日期:2014-05-18  浏览次数:20386 次

不能联合删除数据吗
CREATE   PROCEDURE   YearToNextYear   AS
begin
delete   from   D_MaterialStock,D_MaterialInfo   where   D_MaterialStock.MaterialID=D_MaterialInfo.MaterialID   and   (D_MaterialStock.MatStockID   not   in   (
select   top   1   D_MaterialStock.MatStockID   from   D_MaterialStock,D_MaterialInfo   where   D_MaterialStock.MaterialID=D_MaterialInfo.MaterialID   order   by   D_MaterialStock.Stockdate   desc))
end
GO
delete   from   D_MaterialStock,D_MaterialInfo   附近‘,’有错误
在关键字   'order '   附近有语法错误。

------解决方案--------------------
delete from D_MaterialStock,D_MaterialInfo
--------------------------
让系统如何去判断删哪个表?

删第1个:
delete D_MaterialStock from D_MaterialStock,D_MaterialInfo

删第2个:
delete D_MaterialInfo from D_MaterialStock,D_MaterialInfo