开发者

Help needed with sql query

I have a table which have an integer coloumn. Let table name is Table1 and ColName is Col1. I want to add number 15 to every value in col1. wh开发者_如何学运维at will be the sql query for this.


If you're just trying to do that via a select:

select col1 + 15 from Table1

or if you need to update the actual rows in the table:

update Table1 set col1 = col1 + 15


This query updates the Col1 values in your table:

UPDATE TABLE Table1
SET Col1=Col1+15

Be carefull - if your column name contains numbers you should use this syntax:

UPDATE TABLE [Table1]
SET [Col1]=[Col1]+15


UPDATE Table1 SET Col1 = (Col1 + 15)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜