I'm looking to alter the query below to pull the first non match from table1. I basically need to make sure that there isn't a match in
Code:
SELECT TOP 1 table1.Numbers
FROM table1
LEFT JOIN qryMPCSwitches5 ON table1.Numbers = qryMPCSwitches5.LOC_NUM
WHERE Right(Numbers,1)='0';"
Right now it's finding the first match between the tables that meets the criteria.
I will also need to do it to this one, but I assume the concept will be the same:
Code:
SELECT TOP 3 table1.Numbers FROM table1 LEFT JOIN qryMPCSwitches5 ON table1.Numbers = qryMPCSwitches5.LOC_NUM WHERE (((Left([Numbers],Len([Numbers])-1)) In (SELECT Left([Numbers],Len([Numbers])-1) AS Prefix FROM table1 GROUP BY Left([Numbers],Len([Numbers])-1) HAVING (((Sum(IIf(Right([Numbers],1)=5,1,0)))>0) AND ((Sum(IIf(Right([Numbers],1)=7,1,0)))>0) AND ((Sum(IIf(Right([Numbers],1)=9,1,0)))>0)))) AND ((Right([Numbers],1)) In (5,7,9)));
Basically the numbers in the table just can't match.