Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

How to put multiple joins in a query

(0) ShareShare
ReportReport
Posted on by 20

I have tables and views a, b, c, d waiting for a query.

b needs using inner join with a,

c needs using exists join with a,

d needs using exists join with a.

So how should i put them in a query code?  I am currently putting inner join first and exist join later but the query crashes when it reaches first exist join. Please help. 

Like :

if(condition B stands )
{
qdbsB = qbdsA.addDataSource(B);
qdbsB .addLink(fieldNum(A,field A),fieldNum(B,field B));
qdbsB .joinMode(JoinMode::InnerJoin);

Range B
}

if(condition C stands )
{
qdbsC = qbdsA.addDataSource(C);
qdbsC .addLink(fieldNum(A, field A),fieldNum(C,field C));
qdbsC .joinMode(JoinMode::ExistsJoin);

Range C

}

if(condition D stands )
{
qdbsD = qbdsA.addDataSource(D);
qdbsD .addLink(fieldNum(A,field A),fieldNum(D,field D));
qdbsD .joinMode(JoinMode::ExistsJoin);

Range D
}

  • Martin Dráb Profile Picture
    231,782 Most Valuable Professional on at
    RE: How to put multiple joins in a query

    Your pseudo-code looks all right to me. What exactly do you mean by "the query crashes when it reaches first exist join"? What error are you getting?

    By the way, please use Insert > Insert Code (in the rich formatting view) to paste source code. It preserves line indentation (amoung other things), which makes code easier to read.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,782 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans