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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

X++ using maxof and minof in the same sql statement

(0) ShareShare
ReportReport
Posted on by 352

Hi Everybody

How can we use at the same time minof and maxof in one sql statement ?

like doing select maxof(AccountingFate), minof(AccountingDate) from .... ?

  • Suggested answer
    Mea_ Profile Picture
    60,286 on at

    You cant, result is saved into the field, so the easiest way is to do 2 select statements 

  • Suggested answer
    julianto1988 Profile Picture
    10 on at

    Hi,

    I have faced the same requirement and I achieved by creating a view with string computed column.

    public static server str MinAccountingDate()
    {
    tableName viewName = tableStr(View);


    return SysComputedColumn::min(SysComputedColumn::returnField(viewName, identifierStr(viewDatasourceTable) , fieldStr(viewDatasourceTable.AccountingDate)));

    }

    public static server str MaxAccountingDate()
    {
    tableName viewName = tableStr(View);


    return SysComputedColumn::max(SysComputedColumn::returnField(viewName, identifierStr(viewDatasourceTable) , fieldStr(viewDatasourceTable.AccountingDate)));

    }

  • Suggested answer
    JauB Profile Picture
    352 on at

    Yes that's why I did, but wished to do it proprly .. !

    Thanks

  • Suggested answer
    JauB Profile Picture
    352 on at

    Thanks Julian for your suggestion

  • Suggested answer
    julianto1988 Profile Picture
    10 on at

    You're welcome, just let me know if you need more help..

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 528 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 424 Super User 2026 Season 2

#3
CU10121822-0 Profile Picture

CU10121822-0 374

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans