Hi I want to find the oldest date from a string date column in format 20180209 00:00:00
.
I am using the following query to get the string column in date
format
select from_unixtime(unix_timestamp(acc_last_change_date, 'yyyyMMddHHmmss')) from ACCOUNTS
but the result is returned as null
.
Could you help me on same.
Just use min()
:
select min(acc_last_change_date)
from accounts;
Your string is in a suitable format for using min()
.
If you want the entire row, you can use:
select a.*
from accounts a
order by a.acc_last_change_date
limit 1;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.