How to use SubQuery in OQL From Clause

Hi, I have a Master record Tool and multiple process records for each tool. In a report, for each master record, the latest, ie maximum process date record details should be shown in the report. I tried the below query in OQL, but it throws runtime exception. Select TL.ToolNo as RToolNo,Description,ProcessDate,Balance_Shots,Balance_LifeTime From LookUp.Tool as TL, ToolProcess.ToolUsageMaintenance as TUS, (Select T1.ToolNo as Tool, Max(TS1.ProcessDate) as MxProcDate From LookUp.Tool as T1  JOIN T1/ToolProcess.ToolUsage_Tool/ToolProcess.ToolUsageMaintenance as TS1 Group by T1.ToolNo) as TMX where TL.ID = TUS/ToolProcess.ToolUsage_Tool/LookUp.Tool.ID  and TL.ToolNo = TMX.Tool and TUS.ProcessDate = TMX.MxProcDate  Exception: Error on finding meta object of location TMX.Tool It does not recognize subquery alias TMX
1 answers

What I normally do with this kind of subquery is creating an IN statement. That will work for sure. Example:


select a.* from SomeTable a
inner join SomeDomain.SomeTable_OtherTable/SomeDomain.OtherTable b
where b.someid in (select c.otherid from SomeDomain.YetAnotherTable c )