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)

sql query error

(0) ShareShare
ReportReport
Posted on by 497

i have a query this below :

select sum(b.ACCOUNTINGCURRENCYAMOUNT), a.ACCOUNTINGDATE, b.LEDGERACCOUNT
from GENERALJOURNALENTRY as a
inner join GENERALJOURNALACCOUNTENTRY as b
on a.RECID = b.GENERALJOURNALENTRY
group by b.ACCOUNTINGCURRENCYAMOUNT

but display error as this below :

Column 'GENERALJOURNALENTRY.ACCOUNTINGDATE' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.

can you help me?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    You have to either use an aggregate function (such as maxOf(AccountingDate)), or add the field to GROUP BY clause. Accessing a group of values without aggregation can't provide any meaningful value.

  • Ehtasham Rahman Profile Picture
    672 on at

    Using GROUP BY clause will always return the values which will be used in GROUP BY clause. No other values will be allowed to retrieve. Change it.

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
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans