1

所以我想知道有多少货物运送了多少不同的物品。例如:我有一份按装运对数据进行分组的报告。即每次装运多件商品。现在我要做的是按物品数量对它们进行分组以回答这个问题:“有多少批货物运送了 4 件物品?”

像这样的东西:

5 Shipments with 2 items <--------------------- How do I get these groups?
    Shipment # 123443     Number of items: 2  \
    Shipment # 342312     Number of items: 2   \
    Shipment # 218245     Number of items: 2    = These are already groups with a
    Shipment # 342523     Number of items: 2   /   count of items per shipment
    Shipment # 345234     Number of items: 2  /

2 Shipments with 3 items  
    Shipment # 218154     Number of items: 3
    Shipment # 1518451    Number of items: 3 
4

1 回答 1

1

您必须在数据库端或通过 CR 中的 SQL 命令或 SQL 表达式来实现这一点。例如,类似下面的 SQL 表达式就可以工作:

(select count(item)
from shipment
where shipmentID = "shipment"."shipmentID")

然后只需对这个新表达式进行分组,它将为您提供报告中每一行的每批货物的数量。

于 2012-09-24T20:05:07.777 回答