RE: Getting most recent row from Database

From: Dhruti Ramani (dhrutiraman..ahoo.com)
Date: Mon Jul 18 2005 - 16:41:38 EDT

  • Next message: Emre Yilmaz: "Relational Query problem?"

    Thanks,
    Denna

    "Gentry, Michael (Contractor)" <michael_gentr..anniemae.com> wrote:
    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

    __________________________________________________
    Do You Yahoo!?
    Tired of spam? Yahoo! Mail has the best spam protection around
    http://mail.yahoo.com



    This archive was generated by hypermail 2.0.0 : Mon Jul 18 2005 - 16:41:39 EDT