List:General Discussion« Previous MessageNext Message »
From:Christian Mack Date:August 11 1999 6:31pm
Subject:Re: Use (problem with?) LIMIT in select statement
View as plain text  
tonu-mysql@stripped wrote:
> 
> On Wed, 11 Aug 1999, Paul McAvoy wrote:
> 
> > Hi, I am currently using Mysql 3.22.25-1 (RPM).  I think that I may have found
> > a bug, or it may be that I am unclear on how the select statement works.
> >
> > My Query is similar to this:
> >
> > SELECT id,name FROM list ORDER BY name LIMIT 20;
> >
> > I was under the impression that teh LIMIT clause was used to limit the
> > return set.
> 
>   Yes, it must work like you understood. It must order all items in your
> table and THEN take the first 20 records and give them back. If it does
> something different, then it's wrong.
> 
>     Tonu

Hi

Mysql doesn't do this.
As described in the manual mysql will stop getting results, when it reached the given
amount.
It will only satisfy the WHERE part of your query.
The ordering is done after getting the results.
So you get with the above SELECT 20 rows which are ordered, not the first 20 from the
ordered list.

Tschau
Christian

Thread
Use (problem with?) LIMIT in select statementPaul McAvoy11 Aug
  • Re: Use (problem with?) LIMIT in select statementtonu-mysql11 Aug
    • Re: Use (problem with?) LIMIT in select statementChristian Mack11 Aug
      • Re: Use (problem with?) LIMIT in select statementtonu-mysql11 Aug
        • Re: Use (problem with?) LIMIT in select statementSteve Edberg11 Aug
        • Re: Use (problem with?) LIMIT in select statementTonu Samuel11 Aug
      • Re: Use (problem with?) LIMIT in select statementSteve Ruby11 Aug
      • Re: Use (problem with?) LIMIT in select statementThimble Smith11 Aug
        • Re: Use (problem with?) LIMIT in select statementPaul McAvoy11 Aug
      • Re: Use (problem with?) LIMIT in select statementPaul McAvoy11 Aug
      • Re: Use (problem with?) LIMIT in select statementPaul DuBois11 Aug
    • Re: Use (problem with?) LIMIT in select statementChristian Mack12 Aug
RE: Use (problem with?) LIMIT in select statementClinton11 Aug