web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Power Apps Lookup/SQL ...
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:
I have the same question (0)
  • GeekAlf_Pro Profile Picture
    402 on at

    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

  • hanzelmans Profile Picture
    on at

    @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

  • timl Profile Picture
    36,815 Super User 2026 Season 1 on at

    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

    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

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 914

#2
11manish Profile Picture

11manish 627

#3
Valantis Profile Picture

Valantis 598

Last 30 days Overall leaderboard