Exclude local csv from SQL query in Workbench

36 Views Asked by At

I don't know if this is possible or if it's a stupid question, so please feel free to re-direct my efforts.

I have a SQL query grabbing transaction data from a database. Some of the locations are test locations that need to be excluded. Unfortunately, the flag for that is not in the database (yet). So I have a locally stored CSV of test locations that need to be excluded.

Currently, I'm exporting the data from the query and then excluding it in excel. But it would be nice to have the query exclude the data from the get go.

One option that I could do is write a long query based on the csv with a long string of

WHERE not (field="test1" or field="test2" or ... or field = "testn")

and just include that into the query. I could generate that in excel relatively easily I think.

But before I did that, I wondered if there's a more direct way?

Can I have a workbench SQL query that excludes/includes certain values from a particular field?

0

There are 0 best solutions below