shaoxuecheng 发表于 2008-5-18 12:44

急请高手指教SQL

カード番号              回収カード番号 回収月  摘要番号 元金残
12345        5      1        100
12345        5      1        100
12345        5      1        100
12345        5      1        100
12345        5      2        500
12345        5      2        500
12345        5      2        500
12345        5      3               130
sum(元金残) = 100 + 500 + 130 = 730
相同的 カード番号 ,回収月 时 摘要番号distinct ,sum(元金残) ???
* 同一摘要番号时,元金残同一
SQL怎么实现 阿 ?

红苹果 发表于 2008-5-19 11:23

怎么有乱码啊?

su1985 发表于 2008-5-26 13:14

回复 1# shaoxuecheng 的帖子

发完也不自己看看.乱码  谁回你.真是的.

huwangvs 发表于 2008-5-26 14:32

是日语吧。。。。
先翻译下,看着不爽。。。。

wildleopard 发表于 2008-5-28 13:59

回复 1# shaoxuecheng 的帖子

按1 , 2, 3 分组查询或其他条件.

saberasurada 发表于 2008-5-31 23:53

是做对日软件的吧。

对你的描述有点不能理解[tk17]
什么叫“摘要番号distinct ,sum(元金残) ???”,“摘要番号distinct ,sum(元金残) ???”,不明白

你要的结果是(猜测):
回収月   摘要番号 元金残
1        400
2        1500
3        130
是吗?

如果是的话,对应的sql是:

select 回収月 , sum(摘要番号 元金残)
from test
group by カード番号, 回収カード番号, 回収月

页: [1]

编程论坛