-
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?
-
What DBMS are you using?. Also post the query you are using.
-
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!!!
-
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
-
Forum Rules
|
|