(select distinct(first_device) as device_id from ml_user_history_detail where partition_date = '{today_str}' and date_joined >= '{yesterday_str}') t2
(select distinct(first_device) as device_id from online.ml_user_history_detail where partition_date = '{today_str}' and date_joined >= '{yesterday_str}') t2
LEFT JOIN
(
select distinct device_id
...
...
@@ -168,7 +168,7 @@ WHERE spam_pv.device_id IS NULL