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 Automate / Join multiple SQL Tables
Power Automate
Unanswered

Join multiple SQL Tables

(2) ShareShare
ReportReport
Posted on by 795
Want to know if this is possible.
I have 4 related tables in sql that I need to query to return a set of results:
Get rows - job
Get rows - linked_equipment ( job.id=foreignID)
Get rows - equipment (ID in linked_equipment.equipmentID)
Get rows - class_link (foreignID = equipment.id)

I can do the first filter but I know I then need to use compose somehow as I cannot have nested for each loops.

Thanks in advance
Categories:
  • v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @Delid4ve,

     

    You could take a try with the Aggregation transformation under SQL Get Rows action, then expand the query with related tables:

    Transformation expand

    Follow the article above for the parameters.

     

    There is a workaround for Apply to each, we could take use of variables, within a Do until, to work with two Get rows action.

    For the four, I am not sure if it would work.

    I will make some tests on this, there might be some time delay before I could share any results.

     

    Regards,

    Michael

  • sundayDriver Profile Picture
    Microsoft Employee on at

    Hi @v-micsh-msft,

    I'm trying to apply the same principle but I can't seem to understand how to do this. Could you elaborate with an example and some screenshots from a flow?

    Thank you,

  • Delid4ve Profile Picture
    795 on at

    I havnt tested this but now im more familiar you should be able to do this:

     

    get rows from 1st table, top count 1.

    use compose and get the first ID.

    now do the for each on the next table using the compose value as the filter on ID.

     

    This is what i havent tested but it should work some how i think:

     

    Use concat to put the IDs from the for each in a comma seperated string

    in the next get rows query -  ID in Or(  Dynamic content string of comma seperated values  ) - youll have to play about with the format, it may be when you create the string have the seperator as: ' or '  so that it formats like  '1' or '2' or '3'

    when i get a chance ill have a play.

     

     

  • HenryADNewComm Profile Picture
    4 on at

    Flow can also read a view instead of a table. To create a view you need access to the database with SQL Management Studio (free to download from MS). with a few joins you can create the view you need.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 377

#2
11manish Profile Picture

11manish 292 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 128

Last 30 days Overall leaderboard