HOW TO WRITE GROUP BY IN MENDIX OQL BASED ON ASSOCIATION TABLE VALUES - Mendix Forum

HOW TO WRITE GROUP BY IN MENDIX OQL BASED ON ASSOCIATION TABLE VALUES

3

Hi,

I am using two tables 
1) Status (Entity)
    StatusName (Atrribute)
    Description
    
2) EmpTable (Entity)
    EmpName (Atrribute)
    EmpId (Atrribute)
    SomeXyz files((Atrribute) 
    
    And i have a association from Status (Entity) and EmpTable (Entity) with one Status object is association with multiple EmpTable object
    
    Now my question is how to write a OQL query for the requirement 

    How many emps of each type of StatusName i.e GROUP BY using StatusName
    

  I am using OQL   https://appstore.home.mendix.com/link/app/66876/

 

O/P :- 
    ===============================
    ==COUNT(OF Emps) | StatusName==
    ===============================
    ==               |              ==
    ==               |              ==
    ==               |              ==
    ==               |              ==

asked
1 answers
2

Have a look at the documentation: https://docs.mendix.com/refguide/oql-group-by-clause

There is an example similar to that what you are trying to accomplish:

SELECT COUNT(Sales.Customer/*)
FROM Sales.Customer
INNER JOIN Sales.Customer/Sales.Customer_Address/Sales.Address
GROUP BY Sales.Address/City

This query returns the count of all customers per city.

 

answered