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 :
Customer experience | Sales, Customer Insights,...
Answered

Advanced Find Queries SQL

(0) ShareShare
ReportReport
Posted on by 15

Morning All, 

We are currently 2 weeks away from a migration from an on prem legacy CRM to Dynamics365, to that end a number of reports that are currently SQL scripts need to be ported and for the most part i can rebuild these using the Advanced Find query builder and save as views. However a view are a little more complex and as i dont know SQL i was looking for a pointer to the best solution. 

The query has a statement like the below where we are trying to target a Serial Number that has communication in the last 720 days where the source code is like "AXTX1..."   

select distinct serialnumber from communication where

(   SOURCECODE LIKE 'AWTX1_-54/003' AND DATEOFCOMMUNICATION >= GETDATE() -720)

OR (SOURCECODE LIKE 'AWTX1_-54/004' AND DATEOFCOMMUNICATION >= GETDATE() -720)

While i can specify the Source Code in advanced find how can i pick up if this contact received the comms in last 720 days?

Thanks in Advance

I have the same question (0)
  • Suggested answer
    Pedro Cadavez de Freitas Profile Picture
    on at

    Hello Brookie,

    Hope you are well.

    On advanced find (checked v9.0.17 onprem and CRM online), you have options on date fields around "older than X" days/weeks etc.

    It seems we have a limitation on using 500 days / 100 weeks / 100 months

    Maybe you could use older than 24 months  = 730 days or  100 weeks == 700days 

    pastedimage1594304270720v1.png

    pastedimage1594304289521v2.png

    But using fetchXML it seems you don't have that limitation

    pastedimage1594305345209v1.png

    Let me know if this is valuable or not, or if it tottally misses the context of the questions!

    Thank you!

  • Brookie Profile Picture
    15 on at

    brilliant, thats the ticket, helped me a load as i need to construct a loads of these style queries over the next 2 weeks. As my query was -720 days i used Last X years and set to 2

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 43 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans