Stitch Data [2021] -
SELECT * FROM table_a a LEFT JOIN table_b b ON a.email = b.email OR a.phone = b.phone ⚠️ Be careful with OR – it can cause record multiplication. For complex cases (anonymous + logged-in users), build a mapping table.
df_crm['email'] = df_crm['email'].str.lower().str.strip() df_support['email'] = df_support['email'].str.lower().str.strip() A. Simple Join (Deterministic) Use when you have a perfect matching key. stitch data
CREATE TABLE id_mapping AS SELECT anonymous_id, user_id, MIN(first_seen_at) AS first_seen FROM events WHERE user_id IS NOT NULL GROUP BY anonymous_id, user_id; SELECT * FROM table_a a LEFT JOIN table_b b ON a
