-- presto
1 SELECT var 2 ,IF(strpos(var,'-')>0,date(substring(var,1,10)),CAST(parse_datetime(CAST(substring(var,1,10) AS varchar), 'yyyyMMdd') AS date) ) 3 ,'IF(strpos('||var||','||''''||'-'||''''||')>0,date(substring('||var||',1,10)),CAST(parse_datetime(CAST(substring('||var||',1,10) AS varchar),'|| ''''||'yyyyMMdd'||''''||') AS date))>=current_date - INTERVAL '||'''' || '60' ||''''||' DAY ' 4 ,IF(strpos(var,'-')>0,date(substring(var,1,10)),CAST(parse_datetime(CAST(substring(var,1,10) AS varchar),'yyyyMMdd') AS date) ) 5 --,CAST(parse_datetime(CAST(var AS varchar), 'yyyyMMdd') AS date) 6 ,CAST(parse_datetime(CAST(var AS varchar), 'yyyyMMdd') AS date) 7 FROM ( 8 --SELECT '2021-01-01' var UNION ALL 9 SELECT '20210101' var 10 )
-- mysql
select 'ods_t_jdsz_cus_daily', count(*)
from ods_t_jdsz_cus_daily
where IF(instr(last_modify_time,'-')>0,date(substring(last_modify_time,1,10)),str_to_date(substring(last_modify_time,1,10),'%Y%m%d') )>=current_date - INTERVAL '3' DAY