更新并增加10 [英] UPDATE and increment by 10

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

问题描述




i想要更新数据库表中的每个字段并增加10.


所以它看起来像


10,20,30,40,50

如果有人能帮忙就会很棒

解决方案

version2 napisal(a):

NTG,...


更新my_table set field = (字段+ 10);


应该这样做。


我正在考虑重置所有值列和给出

第一个值10 htne 2值20等等


你能帮忙吗?

Ac1d ^写道:


version2 napisal(a):

NTG,...


更新my_table set field =(field + 10);


应该这样做。


Ac1d ^写道:


> NTG ,...

更新my_table set field =(field + 10);

应该这样做。



version2写道:


i我正在考虑重置列中的所有值给出

第一个值10 htne 2值20等等



为什么不开始解释你的问题''我试着用这个来解决

?它对我来说闻起来像是一个令人讨厌的黑客。


假设你已经有了增量数字,你可以做


UPDATE my_table

SET字段=(字段* 10)


此外,这与PHP无关。将来,您可能需要

来尝试comp.databases.mysql(或者您使用的任何数据库的appriate组)


Tim


Hi,

i want to update each field in a database table and increment by 10.

so it will look like

10, 20, 30, 40, 50

if anyone can help it would be great

解决方案

version2 napisal(a):
NTG, ...

update my_table set field = (field+10);

that should do.


i am looking at resetting all the values in the column and giving the
first value 10 htne 2 value 20 and so on

can you help?
Ac1d^ wrote:

version2 napisal(a):
NTG, ...

update my_table set field = (field+10);

that should do.


Ac1d^ wrote:

>NTG, ...

update my_table set field = (field+10);

that should do.

version2 wrote:

i am looking at resetting all the values in the column and giving the
first value 10 htne 2 value 20 and so on

Why don''t you start by explaining what problem you''re trying to solve
with this? It smells like a nasty hack to me.

Assuming you already have the incremental numbers, you can do

UPDATE my_table
SET field=(field*10)

In addition, this has nothing to do with PHP. In future, you might want
to try comp.databases.mysql (or the appriate group for whatever DB you use)

Tim


这篇关于更新并增加10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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