Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Answered

How to Retrieve Just One Row from an SQL View

(0) ShareShare
ReportReport
Posted on by 84

I'm currently trying to figure out how to fetch only a single row from an SQL view using Power Automate. I'm aware of the "Get row" action, but it seems to be limited to SQL tables and doesn't list views as an option.

 

On the other hand, the "Get Rows" action does include views. However, my challenge arises when I attempt to use the values fetched. Even though I specify that I want only the top row by setting the limit to 1, Power Automate automatically generates an "Apply to each" action.

Is there a way to prevent the creation of the "Apply to each" action when I'm only interested in the first row from the view?

Any advice or workarounds would be greatly appreciated!

 

 

AmirZolf_0-1712588860687.png

 

 

AmirZolf_1-1712588879757.png

 

 

 

AmirZolf_2-1712588922172.png

 

  • Amirhz Profile Picture
    84 on at
    Re: How to Retrieve Just One Row from an SQL View

    That worked, thanks

  • Verified answer
    ScottShearer Profile Picture
    25,208 Most Valuable Professional on at
    Re: How to Retrieve Just One Row from an SQL View

    @AmirZolf 

    If there is only one item returned, the loop really isn't hurting anything.  

    One way to avoid the loop is by using the first() expression.  See my example below.  I am using SharePoint but it shouldn't matter.

    Here are the expressions that I use - I am retrieving the title column

    first(outputs('Get_items')?['body/value'])

    outputs('Compose')['Title']

    image.png

     

    Another way to do this is to reference the first element in the collection [0]

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,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow