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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate - General Discussion
Under review by Community Managers

Under review

Thank you for your post! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Compare two SQL query results, create new columns and export to CSV

Posted on by
I have two different views on same on-prem SQL server/database.  Running two queries (Get Rows) to retrieve data from the views.
 
Both query results need to be compared based on a 'reference number' column.  This value is unique in the first query result, but there may be multiple rows with the same value in the second query results.
 
Will need to construct a single string, appending all column values from the second query result with the same reference number.  Eg. Query returns columns 'Date', 'CompanyName', 'Description'.  The string will be 'Date1 | CompanyA | DescriptionA | Date2 | CompanyB | DescriptionB...'
 
There will also be multiple columns in the second query result that will need to be summed.
 
Finally will need to create a csv with the following :
 
- All columns from first query result
- A new column, with the string described above, where reference number between the two queries match
- Multiple new columns with the sums described above, where reference number between the two queries match
 
I can create a CSV with query results just fine, but have no idea how to go about...everything else described above...
 
Originally performed all this processing in PowerApp, and just ran the flow to create csv based on post-processing data provided by Powerapp.  But the results were incomplete and supposedly this is common issue exporting from gallery...

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 251 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 239

#3
Expiscornovus Profile Picture

Expiscornovus 220 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics