How to build an aml request using a request in a request ?

Hello Aras Community,

i am would like to perform this SQL request but in using AML :  

Innovator _innovator = this.getInnovator();

StringBuilder sql = new StringBuilder();

sql.AppendLine("SELECT ID, ***_code, config_id, state, Major_Rev, Generation, is_current FROM innovator.[***_ROOT_***] ***1 WHERE ***1.generation =(SELECT MAX(generation) from innovator.[***_ROOT_***] ***2 where ***2.state = 'Working' AND ***2.config_id = ***1.config_id)order by modified_on");


Item ***_result = _innovator.applySQL(sql.ToString());

return ***_result;

Basically i need to do a request in a request.

Do you think this is possible ?

thank you so much for any help.