(select first_device as device_id from online.ml_user_history_detail where partition_date = {today_str} and substr(md5(device_id),-1) in ('8', '9', 'a', 'b')) t2
(select 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')) t2