[thelist] MySQL queries and AUTO_INCREMENT

Matt Warden mwarden at gmail.com
Fri Apr 7 12:35:02 CDT 2006


On 4/7/06, Joshua Olson <joshua at waetech.com> wrote:
> > -----Original Message-----
> > From: Max Schwanekamp
> > Sent: Friday, April 07, 2006 12:38 PM
> >
> > 3. If no data returned, query once more:
> >     SELECT [fields] FROM mytable WHERE id < $x LIMIT 1
>
> This is an interesting concept and will presumably work.  You may need to
> add in an ORDER BY clause here, though.

Yes, I think you are correct. Otherwise, the <$x condition would
likely be ordered by id ascending, and you would get the first record
every time. Nice catch, Joshua.

--
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.



More information about the thelist mailing list