On Wed, 30 Mar 2011 10:05:50 +0200
Brent Clark <brentgclarkl...@gmail.com> wrote:

> Hiya
> 
> Im wondering if someone could help me understand this. If you look at my 
> two queries below. By the ORDER BY one is using ` and the other ', as a 
> result, if you do an explain you will see that the top query does a 
> filesort, while the other does not.
> 
> Would anyone know why.
> 
> mysql> explain SELECT `Contact`.`id`, `Contact`.`name`, .... ORDER 
> BY `name` asc LIMIT 10;
this orders by the column `name`, as you expect.
> 
> mysql> explain SELECT `Contact`.`id`, `Contact`.`name`, ....  ORDER 
> BY 'name' asc LIMIT 10;

When you use quotes you are no longer referring to the column, instead the 
order orders by the string 'name'. 
This is a meaningless sort, and your results wil not be ordered at all.

> 
> Thanks
> Brent

-- 
Simcha Younger <sim...@syounger.com>

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to