"Claudia M. Castaneda" wrote:
> We want to do string comparison using SQL. For instance:
> A user asks to return all the strings that have 'asmmsg' at the beginning.
> The database has strings like:
> asmmsgiokl valid
> asmmsgmlsyui valid
> asmmsbtusd not valid
> Is it possible to do this with SQL?
> I have a routine to do this type of comparison in C; would it be possible
> to embed it in MYSQL?
> Claudia M. Castaneda
Sure you can do this with:
SELECT whatEverYouWant FROM yourTable WHERE string LIKE 'asmmsg%'
With LIKE the %-character is a wildcard for everything or nothing and
the _-character is a wildcard for exactly one character.
If your field yourTable.string is a CHAR, VARCHAR or TEXT type then the search with mysql
is case insesitive.
If your field is a CHAR BINARY, VARCHAR BINARY or BLOB type then the search with mysql is