[BNM] Moving to next record in MySQL

Leo Brown leo.brown at acumensystems.net
Thu May 1 11:07:21 BST 2008


"Select top" isn't supported in MySQL

You need "select max(id) from table where id<1325"

Ta,

Leo Brown
Acumen Systems
t 01273 808 101
f 01273 808 110

-----Original Message-----
From: bnmlist-bounces at brightonnewmedia.org
[mailto:bnmlist-bounces at brightonnewmedia.org] On Behalf Of Stuart Dunkeld
Sent: 01 May 2008 10:37
To: Brighton New Media
Subject: Re: [BNM] Moving to next record in MySQL

Something like SELECT TOP 1 ID FROM TABLE WHERE ID < 1325 ORDER BY ID DESC

Stuart

On Thu, May 1, 2008 at 10:27 AM, delarge <delargerock at gmail.com> wrote:
> Hi hey yo
>
>  I wondered if there is a way to do this in MySQL...
>  Say I pick the latest id like SELECT * etc. LIMIT 1
>
>  and that has an id of 1325 for example...
>  so we have a url like:
>  site.com/?id=1325
>
>  now on the next page I want to select the next record down, regardless of
>  its id - so it might be 1287, not neccessarily 1325 -1...
>
>  I know you can do an offset kind of thing like this:
>  ORDER BY id DESC LIMIT 5, 1
>
>  But I don't think that would help...
>  Am I making sense?  Can anyone help?
>
>  --
>  Paul Burgess
>
>  iampaulburgess.co.uk
>  delarge.co.uk
>  urbandirty.com
>  --
>
>  BNM Subscribe/Unsubscribe:
>  http://www.brightonnewmedia.org/options/bnmlist
>
>  Archive Search - http://icanhaz.com/bnmarchive
>
>  BNM powered by Wessex Networks:
>  http://www.wessexnetworks.com
>
-- 

BNM Subscribe/Unsubscribe:
http://www.brightonnewmedia.org/options/bnmlist

Archive Search - http://icanhaz.com/bnmarchive

BNM powered by Wessex Networks:
http://www.wessexnetworks.com



More information about the BNMlist mailing list. Powered by Wessex Networks