web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Can you create a subquery on an another query within the AOT?

(0) ShareShare
ReportReport
Posted on by

I have a created a query within the AOT and I need to add a subquery using the tsql below. This will be the datasource for a SSRS report, so I can not use a view. Is it possible to add subquery to a query? Thanks!

left outer join

(

select t1.ITEMID ,sum(t1.qty)Balance

from INVENTTRANS t1

join InventTransPosting t2

on t1.INVENTTRANSORIGIN = t2.INVENTTRANSORIGIN and

group by t1.ITEMID ) s

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    301,037 Super User 2025 Season 2 on at

    Hi SSRSGuy,

    It is possible to create a view in the AOT with several tables and also tsql. Then you can create a query based on this view as datasource.

  • Community Member Profile Picture
    on at

    Thanks Andre, I am creating this to be a datasource for a SSRS report and you can not use views as a datasouce for ssrs reports (that I know of)

  • Community Member Profile Picture
    on at

    Andre, I just looked at your comment again. So I can base the query on a view? I will give that a try. Thanks!!!

  • Verified answer
    André Arnaud de Calavon Profile Picture
    301,037 Super User 2025 Season 2 on at

    Hi,

    I meant create a query in the AX AOT based on the view. Have you tried that? You can also create a dataprovider class with a temporary table to use as datasource for your report.

  • Community Member Profile Picture
    on at

    I did try that, but I could not copy the summed field in the query to the view. It would not let me drag it. I could drag the field that it was grouped by (itemId). Any idea why?

  • Suggested answer
    Malcolm Burtt Profile Picture
    1,475 on at

    There shouldn't be any reason why you can't use a view here. I would create the subquery as a view and then build a query that includes a join to that view.

  • Suggested answer
    Community Member Profile Picture
    on at

    Thanks guys, I did not realize you could base a query on a view.

    Thanks again!!!!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans