RE: Getting most recent row from Database

From: Gentry, Michael \(Contractor\) ("Gentry,)
Date: Mon Jul 18 2005 - 16:26:03 EDT

  • Next message: Filip Balas: "Re: Abstract ObjEntity?"

    You could try using some direct SQL with an SQLTemplate. Your SQL would
    need to be something like:
     
    select * from myTable where myDateColumn = (select max(myDateColumn)
    from myTable)
     
    That assumes your date column contains valid data (most recently
    inserted row has the most recent date) and that you aren't using MySQL
    or any other DB server which doesn't support nested selects.
     
    /dev/mrg

            -----Original Message-----
            From: Dhruti Ramani [mailto:dhrutiraman..ahoo.com]
            Sent: Monday, July 18, 2005 2:50 PM
            To: cayenne-use..bjectstyle.org
            Subject: Getting most recent row from Database
            
            
            Hi,
             
            I need to take out most recent row of some Object from table. Is
    there a way to do this in cayenne?
             
            I have a Date column in that Object. Is there a way that I use
    this Date and check which one is most recently inserted and get only
    that object?
             
            Thanks,
            Denna



    This archive was generated by hypermail 2.0.0 : Mon Jul 18 2005 - 16:26:07 EDT