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)
精彩评论