Skip to content

Instantly share code, notes, and snippets.

@ryf123
Last active June 29, 2018 18:28
Show Gist options
  • Save ryf123/6f260fbfb98c075211ea13dccb1a2005 to your computer and use it in GitHub Desktop.
Save ryf123/6f260fbfb98c075211ea13dccb1a2005 to your computer and use it in GitHub Desktop.
#standardsql
with users as (
select usr_user_id
from `website.usr_users`
WHERE
TIMESTAMP_MILLIS(usr_signup_date) >= '2018-05-01'
AND TIMESTAMP_MILLIS(usr_signup_date) < '2018-06-01'
AND usr_phn_phone_number_id IS NOT NULL
), req as (
select
DISTINCT pred. request_id
from `modeling.predictions_request_ghosting` pred
JOIN `a.mts_requests` mts on mts.request_id = pred.request_id
where
timestamp_MILLIS(timestamp) >= '2018-05-01'
AND timestamp_MILLIS(timestamp) < '2018-06-01'
AND score < 0.984
AND score > 0.9
)
select is_ghosted, count(*) from users
JOIN `a.mts_requests` mts ON users. usr_user_id = customer_id
JOIN req ON req. request_id = mts. request_id
group by 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment