select using LIKE where first character is a integer

hi,

i have some data in mysql in a column like this:
6.1.01 Financial Regulations
3.32.02 Academic Counseling

what iam selecting is select by letter A, B, C...Z. so my first char in
the column is always a integer, how can i select when the first few
characters are always a integer, i want to get rid of the integers and
run query on the word when selecting.

would greatly appreciate someone's help on this
coolvixs [ Mo, 03 Juli 2006 05:54 ] [ ID #1378588 ]

Re: select using LIKE where first character is a integer

<coolvixs [at] gmail.com> wrote in message
news:1151898875.821589.112670 [at] m73g2000cwd.googlegroups.com.. .
> hi,
>
> i have some data in mysql in a column like this:
> 6.1.01 Financial Regulations
> 3.32.02 Academic Counseling
>
> what iam selecting is select by letter A, B, C...Z. so my first char in
> the column is always a integer, how can i select when the first few
> characters are always a integer, i want to get rid of the integers and
> run query on the word when selecting.
>
> would greatly appreciate someone's help on this

Given these circumstances, it would probably be smarter to match on a more
complete string rather than just the first letter. You could use:
{fld} LIKE '%Financial %'
or
{fld} LIKE '%Academic %"

and this would get you past caring about the irregular leading numeric
digits.
OR
you might take advantage of the fact that the string you are looking for
begins just after the blank space " " that follows the number.

WHERE MID({fld}, LOCATE(' ', {fld})+1, 1) = 'A'

LOCATE() finds the first blank space and MID() shows you the string starting
with the first alpahabetic character that follows.

I like the first solution because it identifies the string more explicitly.
Thomas Bartkus
Thomas Bartkus [ Mi, 05 Juli 2006 18:43 ] [ ID #1380689 ]
Datenbanken » mailing.database.mysql » select using LIKE where first character is a integer

Vorheriges Thema: Order by primary key
Nächstes Thema: How do you drop a foreign key constraint?