cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
loraDallas
Frequent Visitor

SQL Get Rows One to Many

I have two sql tables: 

 

Table A:  Unique A_PK

Table B:  Foreign key A_PK with multiple entries

 

My flow starts with a trigger "When an item is modified" reading Table B returning A_PK.  Then I want to get all rows from Table B where it equals A_PK from trigger.  There could be up to 5 rows for the same A_PK from Table B.  I tried using Sql "Get Rows" where I need the Status field from all rows where A_PK equals A_PK from trigger.   This last part is where I need help with.  

 

Once I get the Statuses from Table B, then I can evaluate and update Table A Status.  That part I can do.  

 

Thanks in advance. 

1 ACCEPTED SOLUTION

Accepted Solutions
gabibalaban
Super User II
Super User II

Hi @loraDallas ,

 

Use the following:

gabibalaban_0-1614787679860.png

Table Name: Table B

Filter Query: A_PK eq @{triggerBody()?['A_PK']} (or triggerBody()?['A_PK']) if you use dynamic content - expression )

Select Query: Status

 

Hope it helps !

View solution in original post

2 REPLIES 2
gabibalaban
Super User II
Super User II

Hi @loraDallas ,

 

Use the following:

gabibalaban_0-1614787679860.png

Table Name: Table B

Filter Query: A_PK eq @{triggerBody()?['A_PK']} (or triggerBody()?['A_PK']) if you use dynamic content - expression )

Select Query: Status

 

Hope it helps !

View solution in original post

Thanks gabibalaban.  I was using the dynamic expression from the trigger but didn't try adding the eq A_PK manually.    I was afraid it wouldn't work, but it did.  Thanks for your help.  

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (3,163)