Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

Cross Company

Posted on by 81
Hi, If you have a SQL query with several joins like doing a while select on the salestable and salesline and you want the query to be cross company, do you need to use the cross company key word for both tables?
 
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,149 Most Valuable Professional on at
    Cross Company
    Adding it just on the first data source will do.
     
    Note that you can easily test it. Add generateOnly keyword to the query and run getSQLStatement() to get the actual SQL query. Then check if the SQL code looks as expected.
     
    For example:
    select generateOnly crossCompany purchTable
        join purchLine
            where purchLine.PurchId == purchTable.PurchId;
    
    info(purchTable.getSQLStatement());

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans