我有一张保险索赔表。它有ID,患者有的条件,ClaimID,EmergencyDepartmentFlag(1 - ED; 0 - NonED。我需要得到的结果给出了每个条件的索赔计数和每个条件下ED就诊的次数
array = %w(first second third)
预期输出
+----------+-----------+----------+--------+
| MemberID | Condition | ClaimID | EDFlag |
+----------+-----------+----------+--------+
| A123 | COPD | 34124434 | 1 |
| A526 | COPD | 34580304 | 0 |
| A693 | COPD | 23723642 | 1 |
| A645 | DM | 46534633 | 1 |
+----------+-----------+----------+--------+
查询
+-----------+-------------+----------+
| Condition | TotalClaims | EDClaims |
+-----------+-------------+----------+
| COPD | 3 | 2 |
| DM | 1 | 1 |
+-----------+-------------+----------+
此查询未返回正确的结果。