I am trying to search by type customerType and I am having a little problem:
SELECT DISTINCT CustomerID, CustomerName, City, State, Zip FROM qrySearchFields WHERE CustomerID in (Select CustomerID from tblCustomerTypeLineItems Where CustomerTypeID = 241)
takes less than a second, and it also performs the following actions:
SELECT DISTINCT CustomerID, CustomerName, City, State, Zip FROM qrySearchFields WHERE CustomerID in (Select CustomerID from tblCustomerTypeLineItems Where CustomerTypeID = 240)
But when I try to use OR to search for both types at once:
SELECT DISTINCT CustomerID, CustomerName, City, State, Zip FROM qrySearchFields WHERE CustomerID in (Select CustomerID from tblCustomerTypeLineItems Where CustomerTypeID = 241) Or CustomerID in (Select CustomerID from tblCustomerTypeLineItems Where CustomerTypeID = 240)
It takes about 40 seconds.
Is there a better way to do this or something that I am missing?
For more information, see Parent Question: Displaying Query Results Horizontal
source share