Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE sandbox.YURBASOV_NGPT_QUIZ_STEP2_JUN_22
- AS
- WITH a AS
- (SELECT DISTINCT e.ticket_number, t.ticket_type, e.hash_uid, d.hash_msisdn
- FROM case_profile_calc.d_phone_x_ticket d
- JOIN metro_data.entries e
- ON UPPER(d.hash_ticket_uid) = UPPER(e.hash_uid)
- JOIN sandbox.d_ticket_type t
- ON t.ticket_code = e.ticket_type
- AND t.ticket_type NOT IN ("60 поездок 90 м", "60 поездок ЕД")
- ), b AS
- (
- SELECT ticket_code, ticket_type FROM sandbox.yurbasov_ngpt_quiz_jun_22
- ) SELECT a.*, b.ticket_code FROM a LEFT JOIN b ON a.ticket_number = b.ticket_code AND a.ticket_type = b.ticket_type
- WHERE a.hash_msisdn IS NOT NULL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement