Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Power Apps Lookup/SQL Server inner join not working?

(0) ShareShare
ReportReport
Posted on by

I have two tables on SQL Server.

 

Table A:

EmployeeIDFollowingIDStudentID
218
229
237

 

Table B has ten columns with the common key between the two tables being the StudentID.  Table B has 500 rows.

 

Using the info in Table A, an inner join should return three rows of data.

 

However, if I use this code it returns 500 rows.

 

ClearCollect(colJoin,
 AddColumns(vw_Students_CaseNumber,"FollowingNumber",LookUp(colFollowing,personID=colFollowing[@StudentID],FollowingID)))

 

If I use this code, it returns three rows.

 

ClearCollect(colJoin, AddColumns(colFollowing,"CaseNumber",LookUp(vw_Students_CaseNumber,StudentID=vw_Students_CaseNumber[@personID],casenumber)))

 

I want to use the former code example as that table has all of the columns, except one, that I want.

 

Why isn't this working?  What am I missing?

 

Thanks,

Steve

 

Categories:
  • hanzelmans Profile Picture
    on at
    Re: Power Apps Lookup/SQL Server inner join not working?

    Hello @timl 

    Thanks for your response.  

     

    When I saw the results of those blocks of code that was exactly what I thought (left outer).  I basically copied it from a few different sites where they were giving that as an example of an inner join.  Hence, my confusion.

     

    Regardless, I am going forward with using views.

     

    Thanks again,

    Steve

  • timl Profile Picture
    34,933 Super User 2025 Season 1 on at
    Re: Power Apps Lookup/SQL Server inner join not working?

    Hi @hanzelmans 

    I'd highly recommend @GeekAlf_Pro 's advice of carrying out the join in view.

    The syntax below is the SQL equivilent of a 'left outer' join (rather than an 'inner join'), which is the reason why it returns 500 rows.

    ClearCollect(colJoin,
     AddColumns(vw_Students_CaseNumber,"FollowingNumber",LookUp(colFollowing,personID=colFollowing[@StudentID],FollowingID)))

     

  • hanzelmans Profile Picture
    on at
    Re: Power Apps Lookup/SQL Server inner join not working?

    @GeekAlf_Pro 

    I actually have that working right now, but wasn't sure if I should/could be doing it in the application.

     

    I'm sure the performance is much better using views, however, I'm a relative novice in regards to Power Apps so I'm trying a few different things.

     

    Thanks,

    Steve

  • GeekAlf_Pro Profile Picture
    400 on at
    Re: Power Apps Lookup/SQL Server inner join not working?

    Hi @hanzelmans 

     

    Personnally, i prefer to use views in my sql database.

    Do you have the possibility to create one ?

    you'll be able to use the right or left join in sql

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,587 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,928 Most Valuable Professional

Leaderboard