Not sure how to ask the question to find topics on this so if someone has a good link to an example of my situation please share.
I have 3 queries all with one common field "Purchase No", I am exporting each query to a txt file when the BAT file is run. I am assuming in order to check to make sure I do not export the same Purchase No multiple times, I need to write the PONo to a separate table and then check that table next time I run the queries, if that makes sense?
You can exclude the results of the first query by using NOT EXISTS. You don't have to create a separate table.
EXISTS (Transact-SQL) - SQL Server | Microsoft Learn
I don't want to exclude the results from the first query from the other two. Example. I have purchase order numbers ; 01, 03, 09, 11. I run all 3 queries separately and in all 3 queries pono's 01, 09, and 11 are outputted. When I run the queries again all I want to output is pono 03 on all 3 queries.
In that case a separate table makes sense.
Any good links I can research you know of?