presto 查询每天固定时间段

select task_id,state,createymd,from_unixtime(createtime) "创建时间",manager_name,open_state,hosted_amount,hosted_date,hosted_time,hosted,
    is_deal,deal_amout,order_mode,order_stype,order_id,manager_id,from_unixtime(close_time) "关闭时间"
    from hive.bdc_dwd.dw_fact_task_new_ss_daily 
    where acct_time=format_datetime(date_add('day',-1,current_timestamp),'yyyy-MM-dd')
    and order_mode not in (2,3,6,7) 
    and par_order_id = 0 
    and (from_cid in (149,192,199,121,126,127,130,197,191,198) or category1id in (4782,5892))
    and category1id not in(4,9,21,448,2107,5787,5857,5788,4788,4791,3064)
    and cast(from_unixtime(createtime) as varchar) BETWEEN concat(FORMAT_DATETIME(DATE_ADD('day',-1,CURRENT_TIMESTAMP),'yyyy-MM-dd'),' ','09:00:00') and 
concat(FORMAT_DATETIME(DATE_ADD('day',-1,CURRENT_TIMESTAMP),'yyyy-MM-dd'),' ','12:00:00')
上一篇:Mysql函数记录


下一篇:数据库:mysql日期函数