List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:April 19 2002 10:26am
Subject:Re: SELECT the first letter MATCH in mySQL
View as plain text  
At 9:00 +0200 4/19/02, Jan Peuker wrote:
>There is a method using trim() but I think it's better to use RLIKE "^A.*"

Regular expression patterns (unlike SQL patterns) don't need to match the
entire string, so RLIKE '^A' is sufficient and more efficient because
it doesn't spend time trying to match anything other than the first
character.

As to the original question (below), that query looks like it should
work.  Perhaps the problem lies elsewhere in the code that executes
the query.  (It may be the query gets modified somehow.  Without seeing
the context, it's hard to say.)

>
>regards,
>
>Jan Peuker
>
>----- Original Message -----
>From: "Son Nguyen" <sonnguyen79@stripped>
>To: <mysql@stripped>
>Sent: Friday, April 19, 2002 8:42 AM
>Subject: SELECT the first letter MATCH in mySQL
>
>
>>  I want to select all the records, which have the first letter matched
>>  the letter 'A'.
>>
>>    $SQL_get_lyrics = "SELECT lyric_title FROM lyrics WHERE lyric_title
>>  LIKE \'A%\'";
>>
>>    Some how this statement given me other record, which has the letter A
>>  inside, too like: "Know A Word" and other other unexpected records
>>
>>
>>
>  >        Son Nguyen

Thread
SELECT the first letter MATCH in mySQLSon Nguyen19 Apr
  • Re: SELECT the first letter MATCH in mySQLJan Peuker19 Apr
    • Re: SELECT the first letter MATCH in mySQLPaul DuBois19 Apr
  • Re: SELECT the first letter MATCH in mySQLCharles Brisson19 Apr
RE: SELECT the first letter MATCH in mySQLMikael Hultén19 Apr
  • Re[2]: SELECT the first letter MATCH in mySQLToomas Vendelin19 Apr
Re[2]: SELECT the first letter MATCH in mySQLToomas Vendelin19 Apr
  • Re[2]: SELECT the first letter MATCH in mySQLPaul DuBois19 Apr