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 Platform Community / Forums / Power Automate / Exclude values stored ...
Power Automate
Unanswered

Exclude values stored in data table from SQL query

(2) ShareShare
ReportReport
Posted on by 17
I have a flow that first reads a CSV file and stores the values in a data table variable. Next, the flow opens a SQL connection and executes a SQL statement. What I'm trying to accomplish is excluding the data table's values from the SQL query results. For sake of example only (I know the syntax is wrong), I want whatever the equivalent is to: "SELECT * FROM members WHERE member_id not in (SELECT member_id from %CSVDataTable%)". In this example, %CSVDataTable% is the variable that was created when reading the CSV file and the rest of SQL statement is what I would execute against the SQL connection. Thoughts?
 
Thanks!
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,969 Moderator on at
    Hi
     
    Can you give more details about what the Field/Fields are you need to match to make sure they don't exist?
     
    You have a couple of options.
     
    1. Depending on the field type you can use in, and depending on whether thats an in (and you have a gallery of ints to compare against), or a string where you have to concat the entire string together to check if its in
     
    2. You could query the data into another gallery and then union them together to take out all the duplicates
     
    Other options are possible but need to understand the uniqe thing, I wasn't sure if member_id is it and is member_id an INT or a STR?
     
     
     
     
     
     
  • schill27 Profile Picture
    17 on at
    The value from the SQL query would be an INT. I'm unsure what the data type is when PAD reads from a CSV. It's very possible these two data types are different from one another.

Under review

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

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 592

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard