Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
Hi
I think you might need to use subquery to individually count the unit and sub_units, example:
SELECT d.id AS dept_id,
d.name,
COUNT(d.id) AS totalDept,
(SELECT COUNT(*) FROM app_fd_units u
WHERE u.c_deptId = d.id ) AS unitTotal,
(SELECT COUNT(*) FROM app_fd_subunits su
LEFT JOIN app_fd_units u ON su.c_unitId = u.id
WHERE u.c_deptId=d.id) AS subUnitTotal
FROM dir_department d
GROUP BY d.id
Do try this attached demo app that gives a report count as per your requirement, hopefully it works correctly.
App was designed for Joget Workflow Enterprise/Professional v6 and for MySQL database.
APP_33096354_count_dept_units.jwa
Cheers
This is exactly what i need. Thanks @Matthew.
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.
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
the following SQL gives me incorrect results.
can anyone help