Hi,
This script is returning true for more than one OR statement, resulting in too many records being returned. I want it to stop if the first one is a match. I'm thinking that should be an IIF statement (instead of using OR... AND as I've done here) but not sure of how to fit that into a WHERE clause.
This script is returning true for more than one OR statement, resulting in too many records being returned. I want it to stop if the first one is a match. I'm thinking that should be an IIF statement (instead of using OR... AND as I've done here) but not sure of how to fit that into a WHERE clause.
Code:
SELECT Employees.[LAST_NAME], Employees.[FIRST_NAME], Employees.[Pay_Method], Employees.[EMAIL_ADR], Employees.[Dept], Employees.[Leader], Members.[Last], Members.[First] FROM Employees, Members WHERE (InStr(basAlphNum(Employees.[LAST_NAME]),Mid(basAlphNum(Members.Last),1,5)) AND InStr(basAlphNum(Employees.[FIRST_NAME]),Mid(basAlphNum(Members.First),1,5))) OR (InStr(basAlphNum(Members.[Last]),Mid(basAlphNum(Employees.[LAST_NAME]),1,5)) AND InStr(basAlphNum(Members.[First]),Mid(basAlphNum(Employees.[FIRST_NAME]),1,5))) OR (InStr(basAlphNum(Employees.[LAST_NAME]),Mid(basAlphNum(Members.Last),1,5)) AND InStr(basAlphNum(Members.[First]),Mid(basAlphNum(Employees.[FIRST_NAME]),1,5))) OR (InStr(basAlphNum(Members.[Last]),Mid(basAlphNum(Employees.[LAST_NAME]),1,5)) AND InStr(basAlphNum(Employees.[FIRST_NAME]),Mid(basAlphNum(Members.First),1,5))) OR InStr(basAlphNum(Members.[Last]),Mid(basAlphNum(Employees.[LAST_NAME]),1,5)) OR InStr(basAlphNum(Employees.[LAST_NAME]),Mid(basAlphNum(Members.Last),1,5)) GROUP BY Employees.[LAST_NAME], Employees.[FIRST_NAME], Employees.[Pay_Method], Employees.[EMAIL_ADR], Employees.[Dept], Employees.[Leader], Members.[Last], Members.[First] ORDER BY (Employees.[LAST_NAME]);
Comment