how do i count number of people in department and other groups
Confluence User - 28 Nov, 2018
Hi Experts,
I have a requirements for tracking people in
In my app, i have departments, units and sub-units. I use the Joget department for departments and groups for the units and sub-units. I have a table that lists groups against departments and one that lists sub-units against units as shown below.
| Table A | Table B | ||||||
| id | departmentId | unitId | id | unitId | subUnitId | ||
I now need to generate a report showing the number of people in a department, the number of units in the department and the number of sub-units in the department as shown below
| Department name | Members in Dept | Units in Dept | Sub-Units in Dept |
the following SQL gives me incorrect results.
SELECT a.id, a.name, count(b.departmentId) AS members, COUNT(c.c_deptId) AS unit, COUNT(e.c_unitId) AS subunit FROM dir_department a left join dir_employment b on b.departmentId = a.id left join app_fd_cap_units c on c.c_deptId= b.departmentId left join app_fd_cap_subunits e on e.c_unitId= c.c_unitId where a.organizationId ="dcphc" group by a.id order by members
can anyone help
datalists;reports