Skip to main content

Notifications

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

Cross Company

(0) ShareShare
ReportReport
Posted on by
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,962 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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,160 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans