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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)
Answered

Alternative for the SQL Having keyword in X++ sql statements.

(0) ShareShare
ReportReport
Posted on by

Hello All,

I have the below SQL query currently working in AX 2012:

while select sum(amount) from tempTable

group by DataAreaID



but I would like to add something similar to a sql having clause, such as below:

while select sum(amount) from TempTable

group by dataAreaID

having sum <> 0

 


But it seem that the having keyword is not supported by X++ sql.

Does anyone have a suggestion how I can implement that select logic? Or any documentation on alternatives to the having keyword? It would be a huge help.

Thank you,

Phil

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Sorry, the second select statement should have read:

    while select sum(amount) from TempTable

    group by dataAreaID

    having sum != 0

  • Verified answer
    Community Member Profile Picture
    on at

    Actually I think I figured this out.

    If I just add a if(TempTable.Amount != 0) statement, I should be able to get the code to work how I want to.

    Thanks everyone who read this!

  • Verified answer
    Martin Dráb Profile Picture
    239,069 Most Valuable Professional on at

    "Having" is supported by the query framework. For example, look at Walkthrough: Creating an AOT Query that has Group By and Having Nodes [AX 2012].

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Andrew Jones a1x Profile Picture

Andrew Jones a1x 2

#3
GL-01081504-0 Profile Picture

GL-01081504-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans