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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 389

#2
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 308

Last 30 days Overall leaderboard

Featured topics