开发者

How to add a fixed value to a int column in mysql without using SUM

I hav a simple query

 SELECT id from table1

I want to ad 20000 to each id but i don't want to use SUM() (That's because i can't use GRO开发者_如何学编程UP BY)

How can i do that?


Not sure if you're asking to just SELECT the data or if you actually want to UPDATE the table, so I'll give both.

SELECT id + 20000 AS IncrementedId
    FROM table1

UPDATE table1
    SET id = id + 20000
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜