0

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?

Dr Xorile
  • 967
  • 1
  • 7
  • 20
  • 2
    Why do you not create the table with testLocations? (or make your database-guy do that ?) – Luuk Sep 18 '21 at 16:54
  • I'm working on it! That's definitely the plan. I'm external to the company so I'm left with begging and pleading, and this falls into the category of "my problem"! – Dr Xorile Sep 18 '21 at 17:02
  • I did the above (include a long where not etc in the query) and it works. It's multistep, but will suffice until I get the field included in the database. – Dr Xorile Sep 21 '21 at 16:21

0 Answers0