From: Christian Mack Date: March 26 1999 10:52am Subject: Re: invoque a user defined program from MYSQL List-Archive: http://lists.mysql.com/mysql/1008 Message-Id: <36FB66F8.DA950C93@compal.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit "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 Hi Claudia 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 case sensitive. Tschau Christian