hii reena this is solution of your query
SELECT StateObj.StateName StateName, (SELECT COUNT(te/ID) FROM MyFirstModule.Employee te WHERE te.Gender='Male' And te/MyFirstModule.Employee_State/MyFirstModule.State/StateName = StateObj.StateName) AS totalMaleEmployee ,(SELECT COUNT(te/ID) FROM MyFirstModule.Employee te WHERE te.Gender='Female' And te/MyFirstModule.Employee_State/MyFirstModule.State/StateName=StateObj.StateName) AS totalFemaleEmployee FROM MyFirstModule.State AS StateObj INNER JOIN StateObj/MyFirstModule.Employee_State/MyFirstModule.Employee e GROUP BY StateObj/StateName
Hi Reena,
If you want to use OQL within Mendix, you can definitely do so. Check out
https://docs.mendix.com/refguide/oql/ Documentation
https://service.mendixcloud.com/p/OQL Playground / Demo
https://marketplace.mendix.com/link/component/66876 Marketplace module
Maybe this:
SELECT StateObj.StateName StateName,
(SUM(CASE WHEN e.Gender='Male' THEN 1 ELSE 0 END)) AS totalMaleEmployee,
(SUM(CASE WHEN e.Gender='Female' THEN 1 ELSE 0 END)) AS totalFemaleEmployee,
FROM MyFirstModule.State AS StateObj
INNER JOIN StateObj/MyFirstModule.Employee_State/MyFirstModule.Employee e
GROUP BY StateObj/StateName