Re: Alphabetical search to and from

2009-11-04 Thread Steve Edberg
At 11:52 PM +0900 11/4/09, Dave M G wrote: MySQL, This should be a fairly simple question. I have a table with a bunch of people's names. I want to find people who's name begins within a certain range of characters. All names between F and P, for example. What SELECT statement would I use to

RE: Alphabetical search to and from

2009-11-04 Thread misiaQ
> Or : > alter table users add first_f_name char(1) not null; > create index first_f_name_idx on users (first_f_name); > update users set first_f_name = left(first_name,1); ... and don't forget the trigger on insert, update to keep that new column always up to date. Regards, m.

Re: Alphabetical search to and from

2009-11-04 Thread Jay Ess
Or : alter table users add first_f_name char(1) not null; create index first_f_name_idx on users (first_f_name); update users set first_f_name = left(first_name,1); And not the query will use index. select username from users where first_f_name between "A" and "B"; -- MySQL General Mailing List

Re: Alphabetical search to and from

2009-11-04 Thread Michael Dykman
gt; - > F > FAA > > Regards, > m. > > -Original Message- > From: Michael Dykman [mailto:mdyk...@gmail.com] > Sent: 04 November 2009 15:19 > To: Dave M G > Cc: mysql@lists.mysql.com > Subject: Re: Alphabetical search to and from > > Haven'

RE: Alphabetical search to and from

2009-11-04 Thread misiaQ
sage- From: Michael Dykman [mailto:mdyk...@gmail.com] Sent: 04 November 2009 15:19 To: Dave M G Cc: mysql@lists.mysql.com Subject: Re: Alphabetical search to and from Haven't tried this myself, but would this not work while permitting the index to engage? select * from country Name between

Re: Alphabetical search to and from

2009-11-04 Thread Michael Dykman
etween 'F' and 'P'; > > Regards, > m. > > -Original Message- > From: Dave M G [mailto:d...@articlass.org] > Sent: 04 November 2009 14:52 > To: mysql@lists.mysql.com > Subject: Alphabetical search to and from > > MySQL, > > This should

RE: Alphabetical search to and from

2009-11-04 Thread misiaQ
Try this: select * from country where LEFT(Name, 1) between 'F' and 'P'; Regards, m. -Original Message- From: Dave M G [mailto:d...@articlass.org] Sent: 04 November 2009 14:52 To: mysql@lists.mysql.com Subject: Alphabetical search to and from MySQL, This shoul

Re: Alphabetical search to and from

2009-11-04 Thread Jay Ess
Dave M G wrote: MySQL, This should be a fairly simple question. I have a table with a bunch of people's names. I want to find people who's name begins within a certain range of characters. All names between F and P, for example. What SELECT statement would I use to do that? Thank you for any

Alphabetical search to and from

2009-11-04 Thread Dave M G
MySQL, This should be a fairly simple question. I have a table with a bunch of people's names. I want to find people who's name begins within a certain range of characters. All names between F and P, for example. What SELECT statement would I use to do that? Thank you for any advice. -- Dave