metalaureate
asked on
Using LIKE with IN
Experts,
I have a query of the form
Select Field1 from T1
where Field1 not in
(Select Excluded_Values from T2)
I want the T2 table values to be wildcard-matched against Field1 (i.e. for the IN match to be a LIKE). LIKE creates an error. Anyone know how I do this?
I have a query of the form
Select Field1 from T1
where Field1 not in
(Select Excluded_Values from T2)
I want the T2 table values to be wildcard-matched against Field1 (i.e. for the IN match to be a LIKE). LIKE creates an error. Anyone know how I do this?
I guess we need a little more to go on....Like, like you said is usually used with a wild card--how many characters do you want to match????
ASKER
I have list of IP addresses to exclude, i.e.
66.180.5.%
128.1.4.%
etc.
I want to exclude all records that match these IP masks.
The problem arose when my list of excluded IP addresses grew too large for concaternations of (AND NOT LIKE '66.180.5.%') etc. etc.
66.180.5.%
128.1.4.%
etc.
I want to exclude all records that match these IP masks.
The problem arose when my list of excluded IP addresses grew too large for concaternations of (AND NOT LIKE '66.180.5.%') etc. etc.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. You got it.
Both jchopde and appari's answer achieve the same results, but jchopde's solution is 600% faster. Anyone know why?
Both jchopde and appari's answer achieve the same results, but jchopde's solution is 600% faster. Anyone know why?