cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NazIM
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
NazIM
Frequent Visitor

@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
Solution Sage
Solution Sage

Perhaps you should use the Get Row Action instead

 

Annotation 2019-10-18 114234.jpg

v-litu-msft
Community Support
Community Support

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.

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

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

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?

 

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).

barret
Continued Contributor
Continued Contributor

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.

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

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

 

image.png

 

NazIM
Frequent Visitor

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

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (4,581)