诸
诸葛白痴
Unregistered / Unconfirmed
GUEST, unregistred user!
二个表:
A: 三个字段A、B、C
B: 三个字段A、B、C
A表内容:
A B C
1 2 1
2 3 2
4 5 5
B表内容:
A B C
1 3 NULL
4 6 NULL
现要将B表的C字段更新成等行A表符合在A与B之间的C总和,意思就是C = Sum(A.C) Where
A.A between B.A and B.B and A.B between B.A and B.B
想得到的结果如下
B表:
A B C
1 3 3
4 6 5
可是我用的语句是:Update B Set C = (Select Sum(A.C) From A,B Where A.A between
B.A and B.B and A.B between B.A and B.B) From A Where A.A between B.A and
B.B and A.B between B.A and B.B
可得到的列值是两列都是10啊,为什么,谁能帮我啊!
A B C
1 3 10
4 6 10
A: 三个字段A、B、C
B: 三个字段A、B、C
A表内容:
A B C
1 2 1
2 3 2
4 5 5
B表内容:
A B C
1 3 NULL
4 6 NULL
现要将B表的C字段更新成等行A表符合在A与B之间的C总和,意思就是C = Sum(A.C) Where
A.A between B.A and B.B and A.B between B.A and B.B
想得到的结果如下
B表:
A B C
1 3 3
4 6 5
可是我用的语句是:Update B Set C = (Select Sum(A.C) From A,B Where A.A between
B.A and B.B and A.B between B.A and B.B) From A Where A.A between B.A and
B.B and A.B between B.A and B.B
可得到的列值是两列都是10啊,为什么,谁能帮我啊!
A B C
1 3 10
4 6 10