如何阅读一些数据库行,总结一些列并存储在集合中?

问题描述 投票:0回答:1

我有一个包含三张纸的Access文件(每张纸属于一个客户),每张纸包含25个星期的9个产品的订单。

我希望将这3种产品中的每种产品的总和存储12个星期。

例如:

order list of customer

我怎么能对数据库进行一些操作(比如列上的总和)并将它们存储在集合中?

database collections anylogic
1个回答
0
投票

像这样的东西。

List <Integer> result=selectFrom(customer1).list(customer1.product1);
double theSum=sum(result,c->c.intValue());

另外一个选项:

int theSum=(int) selectFirstValue(int.class,"SELECT SUM (product1) FROM customer1;");
© www.soinside.com 2019 - 2024. All rights reserved.