On Tue, Feb 13, 2007, Jim Steil wrote:
>
>   Hi:
>
>   Is there an easy way to return a row with a maximum column value in
>   it?  For example:
>
>   I have a log records table.  This table logs the status of a bunch of
>   processes that I schedule here.  For a given process, I want to get
>   the latest log record along with the name of the process.

This probably isn't totally kosher WRT sqlobject philosophy, but
here's what I do with a job that needs to find the latest entry
in a log file:

recs = CronLog.select(
    '(hostname, utime) in '
    '( select hostname, max(utime) from cron_log group by hostname )'
    ,orderBy = ['hostname']
)

Bill
--
INTERNET:   [EMAIL PROTECTED]  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676

When the customer has beaten upon you long enough, give him what he asks
for, instead of what he needs.  This is very strong medicine, and is
normally only required once.
    -- he Consultant's Curse:

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to