一个同事发给我的sql,我需要在mysql里执行,但是这是oracle的语句,求助大神帮忙使用mysql语句实现,拜谢!!!!!!!!
select
case when max(time) is null
then to_date('1900-01-01 00:00:00','yyyy-MM-dd HH24:mi:ss')
else max(time) end time
from table_name
select
case when max(time) is null
then STR_TO_DATE('1900-01-01 00:00:00','%Y-%m-%d %H:%i:%s')
else max(time) end as time
from table_name
这个可以选择用插件的形式
select
case when temp.time is null
then DATE_FORMAT('1900-01-01 00:00:00','yyyy-MM-dd hh:mm:ss')
else temp.time end maxtime
from (SELECT MAX(CREATETIME) time from tab_name) temp;