[thelist] SQL Query

Tab Alleman Tab.Alleman at MetroGuide.com
Tue Aug 19 08:20:26 CDT 2003


rudy wrote:
>>>>   SELECT * from mytable WHERE myfield LIKE "%.%.%"
>>>>     AND NOT myfield LIKE "%.%.%.%"
> 
> the problem with this -- although i have not tested it myself (don't
> gots sql server here at home) -- is that A.B.C.D satisfies both the
> LIKE condition and also the NOT LIKE condition
> 
> see, the percents mean "anything"
> 
> %.%. matches A.B. and then the last % matches C.D
> 
> right?

True, but isn't that the idea?  A.B.C.D matches both conditions and
therefore would not be selected.  A.B.C only matches the first condition
and therefore would be selected.


More information about the thelist mailing list