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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Need help to convert m...
Power Apps
Unanswered

Need help to convert my SQL query to Fetchxml

(0) ShareShare
ReportReport
Posted on by 971

Hello Experts,

 

I need your help and guidance to convert my SQL query to fetchxml which I need in my Report.

 

 

SELECT a.name FROM msft_employee

INNER JOIN account AS a ON msft_employee.msft_company = a.accountid

WHERE msft_employee.statecode = 0 AND msft_employee.createdon = lastxyears(1)

group by a.name having COUNT(a.name)>=100

 

Here's what I am trying to achieve - Fetch All Accounts which has more than 100 openend/active employees created during last 1 year.

 

I did tried to use SQL4CDS plugin from xrmtoolbox but it does not give single fetchxml.

 

Thanks,

Bipin

I have the same question (0)
  • Verified answer
    meelamri Profile Picture
    468 on at

    Hi, 

     

    There is a tool to convert SQL to FetchXml: http://sql2fetchxml.com/

    Unfortunately, your query cannot be translated into fetchXml.

     

    I suggest you to fetch all active employees created during the last year, then group these employees according to the parent account and display the grouping if it contains more than 100 rows.

  • Verified answer
    Bipin D365 Profile Picture
    971 on at

    Hi @melamri ,

     

    I can easily do this from c# code but I need to create report based on fetchxml. So if you can prrovide any solution with respect to Reporting then it will be very helpful.

     

    Thanks,

    Bipin

  • Verified answer
    a33ik Profile Picture
    3,306 Most Valuable Professional on at

    As I suggested in on of the other threads you created yesterday - https://powerusers.microsoft.com/t5/Microsoft-Dataverse/List-of-Accounts-which-has-more-than-100-open-cases-during-last/m-p/1422982#M17013 - create the field, implement recalculation of that field, use the field in the report. As @melamri mentioned - this query can't be directly converted to FetchXml.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard