Dirk, you could try this:
(SELECT * FROM customertable
WHERE <some criteria>
ORDER BY customertableid DESC
ORDER BY customertableid ASC;
Like one sometimes does with UNIONs, but without any UNIONs. Didn't
know whether it would work, but it does (on 5.0.21 anyway).
That will give you the 50 entries with the highest ID numbers, sorted
lowest to highest.
On 6/28/06, Chris White <chriswhite@stripped> wrote:
> On Wednesday 28 June 2006 01:39 pm, Dirk Bremer wrote:
> > Dan,
> > That might be close. The rows are inserted with an auto-increment
> > primary key, but I have no ready way of knowing what the latest 50-IDs
> > are. There are also various date columns, but I won't readily know the
> > dates in this scenario.
> That's why ORDER BY id DESC is used, it basically flips your table reverse, so
> that last inserted (in essence the highest ID) is first, all the way down to
> the first inserted (the lowest ID). Then LIMIT 50 will give you 50 from
> highest id to lowest ID, or the last 50.
> Chris White
> PHP Programmer/DBlonde
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=1