I have a SQL query where I have multiple results from with a non-unique id that I want to get rid of based on if one entry equals a value.
ie. id, billID, transaction – there can be multiple entries for a billID with different transaction values. I want to find transaction values that equal 'testValue' and then remove all entries with that billID.
So far I got my original data that I put into a #tmp1. Then I’m placing all billID‘s where Transaction = 'testValue' into #tmp2.
How do I join these two together, to give results of #tmp1 where not equal to the billID in #tmp2?
Thanks!
You can do this in a single query: