这个存储过程到底怎么写呀?

JeanLaw 2004-03-04 08:40:27
table1

id1 Count
2 0
3 0


table2

id2 name
1 n
2 n
3 n
4 n

table3

id1 id2
2 1
2 5
2 3
2 9
3 4
3 3
3 2

如果要在table3中删除 id2在table3中有而table2中没有的记录,并且每删除一条就在table1中相应的id1的记录的Count加1,这个存储过程应该怎么写呀?

执行完,上面的例子应该是:
table1

id1 Count
2 2
3 0


table2

id2 name
1 n
2 n
3 n
4 n

table3

id1 id2
2 1
2 3
3 4
3 3
3 2
...全文
31 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复

34,837

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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