Skip to content

Instantly share code, notes, and snippets.

@Mr--John-Doe
Created May 31, 2022 07:49
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/ac5c4cf8f823bccc32a82e0132c64bf3 to your computer and use it in GitHub Desktop.
Save Mr--John-Doe/ac5c4cf8f823bccc32a82e0132c64bf3 to your computer and use it in GitHub Desktop.
SELECT da.username
, da.date
, da.hit_count
, ua_1.value as user_address
, ua_2.value as user_mobile
, ua_3.value as user_email_optin
FROM web.daily_activity da
LEFT JOIN web.user_attributes_1 ua_1
ON ua_1.USERNAME = da.USERNAME
AND ua_1.attribute_name = 'MAIN_ADDRESS'
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment