Query runs too slowly
Posted on 2013-01-17
Here's the query:
FROM NC2 a LEFT OUTER JOIN Actions b ON a.UniqueID = b.DealerID
WHERE NOT EXISTS (
FROM Actions c
WHERE c.DealerID = b.DealerID
AND c.EventID = 1
It works, but it can take over a minute to return records. The 2 tables only have a few hundred records each.
What I need it to do is the following:
Select every record in NC2 UNLESS the value of UniqueID in NC2 matches up with a field called DealerID in a table called Actions., and then only if they match and the EventID is equal to 1.