Late afternoon 腦不好使# Database - 数据库
i*a
1 楼
SQL 2005
I need to write 2 queries:
Query 1, blah blah blah
Query 2, I need to hit the rows that are NOT in Query 1
Method A:
Query 1, select blah into #temptable where blah = 1
Query 2, select blah not in (select blah from #temptable)
Method B:
Query 1, select blah where blah = 1
Query 2, select bah not in (select blah where blah = 1)
which one is more efficient? Is query optimize gonna make method B more
efficient? Is the only way to know to see query plan?
I need to write 2 queries:
Query 1, blah blah blah
Query 2, I need to hit the rows that are NOT in Query 1
Method A:
Query 1, select blah into #temptable where blah = 1
Query 2, select blah not in (select blah from #temptable)
Method B:
Query 1, select blah where blah = 1
Query 2, select bah not in (select blah where blah = 1)
which one is more efficient? Is query optimize gonna make method B more
efficient? Is the only way to know to see query plan?