PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > Understanding LIMIT?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Understanding LIMIT?

Réponse
 
LinkBack Outils de la discussion
Vieux 03/11/2007, 19h11   #1
Chris
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Understanding LIMIT?

Can someone explain why the query below doesn't do as I hoped it would
do...return the ten records proceeding the row with an id of 200744?
Please note that id is not an auto increment and can jump from 200744
to 200801.

SELECT * FROM weeknumber WHERE id > 200744 ORDER BY id LIMIT 0,10

Many thanks,

Chris

  Réponse avec citation
Vieux 03/11/2007, 19h36   #2
hadronquark@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Understanding LIMIT?

Chris <matchett123@googlemail.com> writes:

> Can someone explain why the query below doesn't do as I hoped it would
> do...return the ten records proceeding the row with an id of 200744?
> Please note that id is not an auto increment and can jump from 200744
> to 200801.
>
> SELECT * FROM weeknumber WHERE id > 200744 ORDER BY id LIMIT 0,10
>
> Many thanks,
>
> Chris


Because you have ">" instead of "<"? proceeding means to go before.

Did you mean something more like

select * from loginattempts where id < 49 order by id desc limit 3;

  Réponse avec citation
Vieux 03/11/2007, 20h39   #3
Chris
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Understanding LIMIT?

On 3 Nov, 18:36, hadronqu...@gmail.com wrote:
> Chris <matchett...@googlemail.com> writes:
> > Can someone explain why the query below doesn't do as I hoped it would
> > do...return the ten records proceeding the row with an id of 200744?
> > Please note that id is not an auto increment and can jump from 200744
> > to 200801.

>
> > SELECT * FROM weeknumber WHERE id > 200744 ORDER BY id LIMIT 0,10

>
> > Many thanks,

>
> > Chris

>
> Because you have ">" instead of "<"? proceeding means to go before.
>
> Did you mean something more like
>
> select * from loginattempts where id < 49 order by id desc limit 3;


Thanks.

This query is from a pagination script, I want to stop pagination
after 10 records corresponding to the current date's week number i.e.
200744 is Year 2007, Week 44. I can't just add 10 to 200744 as there
are only 52/53 weeks in a year.

However, you are right about 'less than'. After posting this thought
had also crossed my mind...I will pick a future date, caluate the year/
week number from that and work backwards.

Thanks again,

Chris


  Réponse avec citation
Vieux 03/11/2007, 21h11   #4
Paul Lautman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Understanding LIMIT?

hadronquark@gmail.com wrote:
> Chris <matchett123@googlemail.com> writes:
>
>> Can someone explain why the query below doesn't do as I hoped it
>> would do...return the ten records proceeding the row with an id of
>> 200744? Please note that id is not an auto increment and can jump
>> from 200744 to 200801.
>>
>> SELECT * FROM weeknumber WHERE id > 200744 ORDER BY id LIMIT 0,10
>>
>> Many thanks,
>>
>> Chris

>

| proceeding means to go before.
Err, no it doesn't! Proceeding means "A course of action;" and "proceedings"
are things like legal actions.

"Preceding" (notice no "o" and no double "ee"), means
Existing or coming before another or others in time, place, rank, or
sequence; previous.


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 18h57.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11456 seconds with 12 queries