Hmm didn't notice that replies are sent to personal emails :o!
I'll look down that avenue once I've completed the mysql version upgrade
(mysql 4 on my test bench, mysql5 upgrade in progress on the production
server)

Thanks again!

-----Original Message-----
From: Daniel Brown [mailto:[EMAIL PROTECTED] 
Sent: 04 March 2008 16:56
To: Esbach, Brandon; MySQL User Group
Subject: Re: Getting the last item in a "group by" query?

On Tue, Mar 4, 2008 at 11:24 AM, Esbach, Brandon
<[EMAIL PROTECTED]> wrote:
> Thanks for the reply,
>
>  Sorry, should have been more specific on that :).
>  I need to access the last record by date for each serial_number in 
> the  table (not just latest record)

    Okay, this is untested, so I don't know if it will work
Out-Of-The-Box[tm] or not, but it should at least lead you in the right
direction.  Plus, it's back on-list now, so that others can read the
results in the archives when they search on the web.  ;-)

    SELECT t.pass, t.id FROM theTable t WHERE t.serial_number IN (SELECT
DISTINCT serial_number,date FROM theTable ORDER BY date DESC LIMIT 0,1);

--
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to