Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

not to get certain rows

$
0
0

Hi,

We are using sql server 2012. We have one stored proc with multiple queries in it. One of the query is complicated with lot of join and other conditions, whose data is inserted into tmp table. I got one more requirement from business user to eliminate certain types of transactions. For this, I have to make changes to complicated query. Which way is better.

Option 1:  From table1 inner join table2 on table1.ID = Table2.ID and Table1.Type NOT IN (200, 220)

OR

Option 2: Get all transactions into tmp table using that complicated query. Later say

DELETE FROM @tbl where Type IN (200, 220)

Some say that using negation in query joins may not be a good idea.

Thanks,

Spunny


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>