Message-
From: Ian Moore [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 07, 2001 9:28 AM
To: Chris Bolt
Cc: [EMAIL PROTECTED]
Subject: Re: Select Highest ID query
On Thu, Sep 06, at 11:05pm, Chris Bolt ([EMAIL PROTECTED]) wrote:
> SELECT * FROM yourtable WHERE id = LAST_INSERT_ID();
On Thu, Sep 06, at 11:05pm, Chris Bolt ([EMAIL PROTECTED]) wrote:
> SELECT * FROM yourtable WHERE id = LAST_INSERT_ID();
But that will only work if it was the same thread that inserted the last record in
the table. If this is running from say .. a script that just wants the last
inserted record
> Im managing to do this, but I can see that the method im using is
> not as efficient as it could be. What I want to do is this
> Make a query which will grab the record in a table that has the
> highest ID number. The ID field is auto incremental so what its
> saying is that the record with
This is what I use in those situations:
select * from TABLE_NAME order by ID desc limit 1;
On Fri, Sep 07, at 01:43pm, Chris Aitken ([EMAIL PROTECTED]) wrote:
> Hi all,
>
> Just quickly,
>
> Im managing to do this, but I can see that the method im using is not as
> efficient as it could be.
Hi all,
Just quickly,
Im managing to do this, but I can see that the method im using is not as
efficient as it could be. What I want to do is this Make a query which
will grab the record in a table that has the highest ID number. The ID
field is auto incremental so what its saying is that