Analytics table relstionships

Dear COP members,

I can’t seem to find documentation on this hence my question:
I am trying to write an SQL script of the Analytics tables. I have programs with similar enrollment attributes like name, age and gender. One program is used for enrollments and the other programs are for different services. On what field can I join the analytics_enrollment_puid program to the events of the other analytics_event_puid?

1 Like

Hi @WaluQ,

Interesting question! Having a general look at the column names for both tables (analytics_enrollment_* and analytics_event_*) there is a common TEI column. Would that work if you join these tables using JOIN analytics_event_* ON analytics_event_*.TEI = analytics_enrollment_*.TEI?

If you need to select the same columns (with the same name) from both tables, make sure to rename the columns that are found in both tables such as column analytics_event_.uidlevel1 as uidlevel1_event and analytics_enrollment_.uidlevel1 as uidlevel1_enrollment.

Please continue to update us on how this works for you. It might require a bit more work on the query to get the desired result but I hope this is a helpful suggestion. Thanks!

2 Likes