选择记录可以,删除记录的语句却写不出来了

医手 2008-11-18 02:34:00
选择

SELECT * FROM [Department] as ta
where [ParentId]<>'' and
not exists (select 1 from [Department] where ta.[ParentId]=[DepartmentId])


删除

delete FROM [Department] as ta
where [ParentId]<>'' and
not exists (select 1 from [Department] where ta.[ParentId]=[DepartmentId])


问题就出在删除语句的as ta上, 有没什么解决的办法?
...全文
41 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
医手 2008-11-18
  • 打赏
  • 举报
回复
谢谢!太振撼了, 仿佛有点明白了delete的真义...
水族杰纶 2008-11-18
  • 打赏
  • 举报
回复
delete ta from   [Department] ta
where [ParentId]<>'' and
not exists (select 1 from [Department] where ta.[ParentId]=[DepartmentId])

22,209

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧