(select distinct(first_device) as device_id from online.ml_user_history_detail where partition_date = {today_str} and substr(md5(first_device),-1) in ('8', '9', 'a', 'b') and last_active_date >= {last_30_day_str}) t2
--(select distinct(first_device) as device_id from online.ml_user_history_detail where partition_date = {today_str} and last_active_date >= {last_30_day_str}) t2
(select device_id from online.ml_device_day_active_status where partition_date = '{today_str}' and active_type in (1,2)) t2