{
// Define the sub query
DBCommand subCmd = db.createCommand();
DBColumnExpr MAX_DATE_FROM = T_EDH.C_DATE_FROM.max().as(T_EDH.C_DATE_FROM);
subCmd.select(T_EDH.C_EMPLOYEE_ID, MAX_DATE_FROM);
subCmd.groupBy(T_EDH.C_EMPLOYEE_ID);
DBQuery Q_MAX_DATE = new DBQuery(subCmd);
// Define the query
DBCommand cmd = db.createCommand();
// Select required columns