CREATE OR REPLACE VIEW assign_view AS
SELECT a.event_batch_id AS event_batch_id,
(SELECT concat(u.firstname,' ',u.lastname) FROM user u WHERE u.id = a.user_id) AS user_name,
date(a.creation_date) AS creation_date,
group_concat(k.content) AS kpi,
a.created_by AS created_by,
NOW() AS update_date,
a.created_by AS updated_by,
0 as version,
true as enabled
FROM assign a, kpi k
WHERE a.enabled = 1 and k.id = a.kpi_id
GROUP BY a.event_batch_id;