added prefix to event_counts in order to concat the division info later.

master
dtookey 4 years ago
parent 217e833756
commit b85f83bb6a

@ -3,7 +3,8 @@ DROP TABLE IF EXISTS event_counts;
CREATE TABLE event_counts AS
SELECT DATE(timestamp) AS event_date,
all_projects.proj_type AS division_raw,
if(substring(new_value, 1, 1) = '+', 1, -1) AS event_count,
SUBSTRING(all_projects.refnum, 1, 3) AS prefix,
if(SUBSTRING(new_value, 1, 1) = '+', 1, -1) AS event_count,
SUBSTRING(`new_value` FROM 2) AS flag
FROM project_lifecycle
INNER JOIN all_projects ON project_lifecycle.project_number = all_projects.refnum

Loading…
Cancel
Save