如何增加计数列? [英] how to increase the count column?

查看:124
本文介绍了如何增加计数列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在任何编程语言中我们都会将计数变量增加为

count = count +1。但是如何在Tsql整数列中执行此操作?



我有一个带有整数数据类型的'Count'列的表。如果条件成立,我需要增加计数。



从tablename更新set count = count + 1;

in any programming language we do increase count variable as
count = count +1. but how to do this in Tsql integer column ?

I have table with column 'Count' with integer datatype. I need to increase the count if a condition get true.

Update set count = count+1 from tablename;

推荐答案

尝试:
UPDATE MyTable SET MyCount=MyCount+1 WHERE MyColumnName='MyValue'


这篇关于如何增加计数列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆