cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NazIM
Level: Powered On

SQl Get Rows (V2) Unique values

Im struggling with getting only unique values from the SQL Get Rows(V2) output. Has anyone been able to figure it out?

1 ACCEPTED SOLUTION

Accepted Solutions
NazIM
Level: Powered On

Re: SQl Get Rows (V2) Unique values

@yashag2255, Didn't try the method shown in the link. 

 

However, what I succeeded with doing is:

1. Get rows (V2) to run the query.

2. put all the field values into an array usig a ForEach action.

3. Used a Union function in a Compose action to union the array with itself

4. Used a join function to create a string from the array.

 

 

image.png

 

Very convoluted, but its the only way I got it to work! Phew!!

View solution in original post

10 REPLIES 10
365-Assist
Level: Powered On

Re: SQl Get Rows (V2) Unique values

Perhaps you should use the Get Row Action instead

 

Annotation 2019-10-18 114234.jpg

Community Support Team
Community Support Team

Re: SQl Get Rows (V2) Unique values

Hi @NazIM,

 

I found that you have reply a post to a similar question, does that method not work?

https://powerusers.microsoft.com/t5/General-Flow-Discussion/Array-variables-unique-values/m-p/385325...

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

NazIM
Level: Powered On

Re: SQl Get Rows (V2) Unique values

Unfortunately not. Get Row does not work with On Premise Data Gateways.

NazIM
Level: Powered On

Re: SQl Get Rows (V2) Unique values

Did try it, but it does not seem to work.

365-Assist
Level: Powered On

Re: SQl Get Rows (V2) Unique values

Hi Nazi,

 

My example of Flow with Get Row is connected via an On-Premises Data Gatway to an SQL Database. What error do you get when you try it?

 

NazIM
Level: Powered On

Re: SQl Get Rows (V2) Unique values

Just tried again. Get Row (V2) works. I believe the earlier version wasn't.

 

I guess my issue is different though. What I want is the equivalent of "SELECT DISTINCT <Col> .." in SQL (i.e.: Only unique values / no repeats of the same value).

Highlighted
barret
Level: Powered On

Re: SQl Get Rows (V2) Unique values

You might try using the "Execute a SQL Query (V2)" action and pass in an actual SELECT DISTINCT query. That's generally the route I take when I need get distinct data.

Dual Super User
Dual Super User

Re: SQl Get Rows (V2) Unique values

Hey @NazIM 

 

In case you do not plan to go an alternate way of performing the sql query, you can use the below method to identify the unique values by creating arrays: 

https://powerusers.microsoft.com/t5/Microsoft-Flow-Community-Blog/Delete-duplicate-records-items-fro...

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

NazIM
Level: Powered On

Re: SQl Get Rows (V2) Unique values

@ : That's not supported with On-Premise Data Gateway:

 

image.png

 

NazIM
Level: Powered On

Re: SQl Get Rows (V2) Unique values

@yashag2255, Didn't try the method shown in the link. 

 

However, what I succeeded with doing is:

1. Get rows (V2) to run the query.

2. put all the field values into an array usig a ForEach action.

3. Used a Union function in a Compose action to union the array with itself

4. Used a join function to create a string from the array.

 

 

image.png

 

Very convoluted, but its the only way I got it to work! Phew!!

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Users Online
Currently online: 353 members 6,092 guests
Please welcome our newest community members: