这个存储过程到底怎么写呀?
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