One thing for sure si that you cannot do "embedded" (forgot the real term) sql statement. I'm talking about the sql statement between parenthesis. Make a view with that statement and use the view instead. The rest should be ok.
Steeve... --- In development-axapta@yahoogroups.com, "jquinteroz" <[EMAIL PROTECTED]> wrote: > > Hi!: > > I have the following SQL statement: > > select f.itemRelation, f.inventDimId, avg(f.Amount) from > (select itemRelation, inventDimId, accountRelation, max(toDate)as > maxdate from PriceDiscTable > group by itemRelation, inventDimid, accountRelation) > as x > inner join PriceDiscTable as f > on f.itemRelation = x.itemRelation > and f.inventDimid = x.inventDimId > and f.accountRelation = x.accountRelation > and f.toDate = x.maxdate > group by f.itemRelation, f.inventDimId > order by f.itemRelation > > How I can translate this code to X++?. > > Regards. >