Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help changing subquery into unmatched 1

Status
Not open for further replies.

delphi6BDE

Programmer
Sep 28, 2009
21
CA
Can anybody help me change the following subquery into an unmatched query? The way I wrote it is taking 30+ seconds to run which is unacceptable


SELECT tblZs.strZ, tblFS.strFS, tblZs.entID
FROM tblZs INNER JOIN (tblA INNER JOIN tblFS ON tblA.aID = tblFSA.aID) ON tblZs.zoneID = tblA.zoneID
WHERE (((Exists (select tblHistory.fsID from tblHistory where tblHistory.fsID = tblFS.fsID and tblHistory.specsID=3853))=False) AND ((tblZs.entID)=1));

Any help would be appreciated. I've tried using the unmatched wizard, but it doesn't give me any results. The above query I wrote is giving me the proper results, just slowly. The users of the program it runs in would be running it multiple times per customer, so speed is a factor.
 
What about this ?
Code:
SELECT tblZs.strZ, tblFS.strFS, tblZs.entID
FROM ((tblZs
INNER JOIN tblA ON tblZs.zoneID = tblA.zoneID)
INNER JOIN tblFS ON tblA.aID = tblFS.aID)
LEFT JOIN (SELECT fsID FROM tblHistory WHERE specsID=3853
) H ON tblFS.fsID = H.fsID
WHERE tblZs.entID=1 AND H.fsID Is Null

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Wow.. thanks for the quick response. It works great; I plugged it into my code and the listbox is now populating immediately.

Thank you very much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top