View Single Post

   
  #2 (permalink)  
Old 02-28-2008, 07:12 AM
Gazelem
 
Posts: n/a
Default Re: Wildcard in MySQL

Patrick Vanhoucke wrote:

> --- English - Engels ---
>
> In MySQL, the percent sign % is the wildcard. This wildcard
> represents one or more characters, i.e. differentiation between one
> or more characters isn't possible in a straightforward way. Is
> there a way to avoid this limitation? I would like to build a
> search interface that offers the possibility for the user to choose
> between a wildcard that represents exactly one character and a
> wildcard that represents one or more characters.
>
> --- Engels - English ---



You can use the _ underscore symbol to represent a single character while
using a like statement..


Select * from mytable where colname like '__';

would match any record of only 2 characters in length in this simple
example.



Reply With Quote