Hey everyone,I'm trying to cross-reference two tables--one has workshop attendee information and the other has sales data--to determine how many attendees actually purchased a product. The query I have to check the sales table is as follows:SELECT Source, Document_Date, CustomerName, PayorType, Country, City, State, RepTerritory, SLPName, SLPPracticeName, SLPAddress, SLPCity, SLPState, SLPZip, ShipName, ShipAddress1, ShipAddress2, ShipAddress3, CustomerNumber, OrderNumberFROM dbo.SalesDataWHERE (DocType = 'Invoice') AND (Document_Date >= @DVU_Event_Date) AND (CustomerName LIKE '%' + UPPER(@LastName) + '%') OR (ShipAddress1 LIKE '%' + UPPER(@LastName) + '%') OR (ShipName LIKE '%' + UPPER(@LastName) + '%')
The only way I'm found to accurately check the sales table is by running this query passing every last name of the attendees list. The problem I have it that there are 1003 attendees and currently 16005 sales equaling 16,053,015 rows searched. Does anyone know of a better way to approach this?Thanks in advance!