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

Community site session details

Session Id :
Power Automate - Building Flows
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:
I have the same question (0)
  • v-micsh-msft Profile Picture
    on at
    Re: Join multiple SQL Tables

    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
    on at
    Re: Join multiple SQL Tables

    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
    Re: Join multiple SQL Tables

    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
    Re: Join multiple SQL Tables

    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 659 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 386 Moderator

#3
chiaraalina Profile Picture

chiaraalina 290

Last 30 days Overall leaderboard