首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

sql数据库怎么实现int类型数值相加减

2012-02-08 
sql数据库如何实现int类型数值相加减?目前正在做个借书系统,针对书本数量的增减来实现借出归还功能,请各位

sql数据库如何实现int类型数值相加减?
目前正在做个借书系统,针对书本数量的增减来实现借出归还功能,请各位大大帮下忙看下这个代码应该如何编写,不胜感激!!

[解决办法]
假如表tb有个字段total_count表示数量

则:

增加1本:
update tb set total_count=total_count+1 where 条件 

减少1本:
update tb set total_count=total_count-1 where 条件

热点排行