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

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
Highlighted
Frequent Visitor

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
Highlighted
Advocate I
Advocate I

Re: SQl Get Rows (V2) Unique values

Perhaps you should use the Get Row Action instead

 

Annotation 2019-10-18 114234.jpg

Community Support
Community Support

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.

Highlighted
Frequent Visitor

Re: SQl Get Rows (V2) Unique values

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

Highlighted
Frequent Visitor

Re: SQl Get Rows (V2) Unique values

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

Highlighted
Advocate I
Advocate I

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?

 

Highlighted
Frequent Visitor

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
Advocate II
Advocate II

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.

Highlighted
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!

Highlighted
Frequent Visitor

Re: SQl Get Rows (V2) Unique values

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

 

image.png

 

Highlighted
Frequent Visitor

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
firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Top Kudoed Authors
Users online (6,486)