Results 1 to 4 of 4

Thread: Get latest timestamp within seconds

  1. #1
    Join Date
    Aug 2003
    Posts
    15

    Get latest timestamp within seconds

    I am now trying to get the maximum value for a timestamp that has the following format:

    mm-dd-yyyy hh:mm:ss.sss

    I have tried using the MAX aggregate, but it will give me all of the values with the maximum date. I have tried casting it to a TIME data type, but it only gives me the maximum for the hh:mm:ss. What I need to do is get the most recent ss.sss value.

    How is this done?

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    What DBMS are you using?. Also post the query you are using.

  3. #3
    Join Date
    Aug 2003
    Posts
    15
    I am using Sybase Adaptive Server Enterprise 7.

    The query looks something like this:

    select sku.qty_sold, sku.sku_number, retail.sku_retail_id as id, retail.retail_price,
    max(retail.last_edit_timestamp) as lasttime from sac.sku_qty as sku
    key join sac.sku_qty_retail_price as retail on sku.sku_retail_id = retail.sku_retail_id
    group by sku.qty_sold, sku.sku_number, retail.retail_price, id

    Thank you for your help!!!

  4. #4
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    Not sure about Sybase but MS SQL Server can only find difference of 3 ms, anything less than that is considered same.

    May be Sybase has similar limitation.

    How about casting the date time to char and getting max value?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •