本文介绍了如何在sql中的数字字符串中添加所有数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有



在我的表MyTable中,我有一个名为MyColumn的列,其中包含8位数字值。



(即)



MyColumn

20151201

20151204

20181208

20181219



我的要求是我需要一个名为SumColumn的新列,数据应该是使用此公式的MyColumn值的总和。 br $>


(即)



MyColumn SumColumn

20151201 3

20151204 6

20181208 4

20181219 6



公式为



例如

20181219



(2 + 0 + 1 + 8)+(1+ 2)+(1 + 9)



(11)+(3)+(10)



(1 + 1)+(3)+(1 + 0)



(2)+(3)+(1)



(6)



帮助到达这个。

解决方案

Dear all

In my table MyTable I have a column named MyColumn which contains 8 digit numeric value.

(ie)

MyColumn
20151201
20151204
20181208
20181219

My requirement is I need a new column named SumColumn and the data should be sum of MyColumn values with this formula.

(ie)

MyColumn SumColumn
20151201 3
20151204 6
20181208 4
20181219 6

Formula is

For Example
20181219

(2+0+1+8) + (1+2) + (1+9)

(11) + (3) + (10)

(1+1) + (3) + (1+0)

(2) + (3) +(1)

(6)

Help to arrive this one.

解决方案


这篇关于如何在sql中的数字字符串中添加所有数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 21:04