Skip to content

Instantly share code, notes, and snippets.

@Mr--John-Doe
Last active June 22, 2022 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mr--John-Doe/ba5a09ccbf2f68a0e7861aee90c91d7b to your computer and use it in GitHub Desktop.
Save Mr--John-Doe/ba5a09ccbf2f68a0e7861aee90c91d7b to your computer and use it in GitHub Desktop.
original query - variants
SELECT da.username
, da.value:date as date
, da.value:hit_count as hit_count
, ua_1.value:user_address as user_address
, ua_2.value:user_mobile as user_mobile
, ua_3_optin.user_email_optin as user_email_optim
, ua_3_optin.optin_date as user_email_optin_date
, ua_4_optin.value:mobile as user_mobile_optin
, (.....)
FROM web.daily_activity da
LEFT JOIN web.user_attributes_1 ua_1
ON ua_1.USERNAME = da.USERNAME
LEFT JOIN web.user_attributes_2 ua_2
ON ua_2.USERNAME = da.USERNAME
LEFT JOIN web.user_attributes_3 ua_3
ON ua_3.USERNAME = da.USERNAME
LEFT JOIN web.user_attributes_4 ua_4
ON ua_4.USERNAME = da.USERNAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment