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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Times Out. 1

Status
Not open for further replies.

chuckh70

Programmer
Feb 4, 2004
71
0
0
US
Hello,

I have this query, and in short I need to take all of the oaks, and combine them into 1 count. If take out the join, and just use inv_machine it works. If I leave it as is, and just search for one of the oaks it works, but when I try more than one it sits there a while and times out.

Code:
Select count(*) As Machine FROM machinehistory_scan INNER JOIN inv_machine ON machinehistory_scan.id = inv_machine.id AND inv_machine.location = 'Oaks IDF1 - 1st' OR inv_machine.location = 'Oaks IDF2 - 1st' OR inv_machine.location = 'Oaks IDF3 - 2nd' OR inv_machine.location = 'Oaks IDF4 - 2nd' OR inv_machine.location = 'Oaks IDF5 - 2nd' OR inv_machine.location = 'Oaks IDF6 - 3rd'
 
will this work?

Code:
Select count(*) As Machine FROM machinehistory_scan INNER JOIN inv_machine ON machinehistory_scan.id = inv_machine.id AND (inv_machine.location = 'Oaks IDF1 - 1st' OR inv_machine.location = 'Oaks IDF2 - 1st' OR inv_machine.location = 'Oaks IDF3 - 2nd' OR inv_machine.location = 'Oaks IDF4 - 2nd' OR inv_machine.location = 'Oaks IDF5 - 2nd' OR inv_machine.location = 'Oaks IDF6 - 3rd')
 
OMG don't I feel dumb. Yes that was exactly it Thank You very much.
 
sometimes you just need someone else to look at it...i've done the same...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top