Depending on the size of your table, it can be faster using

SELECT lastname FROM employee WHERE lastname BETWEEN 'm' AND 'z' GROUP BY lastname;

On a table with 2,5 Mill. records the speed diff is over 1000% on my system.

ViSolve DB Team wrote:
Hello Paul,

You can try this:

SELECT DISTINCT lastname FROM employee WHERE lastname BETWEEN  'm' AND 'z';

Thanks,
ViSolve DB Team.


----- Original Message ----- From: "Paul Nowosielski" <[EMAIL PROTECTED]>
To: <mysql@lists.mysql.com>
Sent: Friday, July 21, 2006 10:33 PM
Subject: Searching through an alphabetical range


Dear All,

I need to write a query that searches last names between the ranges of m
through z.

Is there a way to do this in the query?


Thank You,

--
Paul Nowosielski
Webmaster
office: 303.440.0666 ext 219
cel: 303.827.4257


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]





--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to