我有这样的数据库结构:

Imgur image link

在数据库中我有很多客户,我知道如何导入客户计数和单值 Assigned employee 但我需要计算所有 Assigned employee . 例如:我有5个客户,每个客户都有一个指定的员工 . 我想收到一份员 Worker 数 - 在这次考试中 5

我导入客户计数的代码:

if let allServices = snapshot.childSnapshot(forPath: "Customer").value {
            if snapshot.childrenCount == 0 {
                self.allService.text = "0"
            } else {
                self.allService.text = (allServices as AnyObject).count.description
            }
        }

谢谢!