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

Notifications

Announcements

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics