Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
jj7353
Starting Member
10 Posts |
Posted - 2013-09-07 : 12:15:57
|
table1 500+ recordsip | area | carid1.1.1.1,dallas,car1192.158.2.1,dallas,car1table2 250+ recordsip | area192.158.2.1,dallas,car1I am trying to return the records in table1 where ip and area combo do not show up in table2. My query is taking way to long.Hope that makes senseThank youJohnnyJohn |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2013-09-07 : 15:26:04
|
SELECT t1.*FROM dbo.Table1 AS t1WHERE NOT EXISTS (SELECT * FROM dbo.Table2 AS t2 WHERE t2.IP = t1.IP AND t2.Area = t1.Area); Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
|
|
jj7353
Starting Member
10 Posts |
Posted - 2013-09-07 : 20:24:18
|
Thank you; I did try that before. I also indexed both tables. ip area index. Its still taking a long time.John |
|
|
|
|
|