SELECT pa.id, CONCAT(upper(replace(left(pa.email, INSTR(pa.email, '@')-1), '.', ' ')),'***') AS name, 'delegado' as role, manager_user_id
  FROM preactivacions pa LEFT JOIN users u
    ON u.email = pa.email
 WHERE 1
   AND u.email IS null

 UNION ALL

SELECT u.id, UPPER(u.NAME) AS NAME, role, manager_user_id
  FROM users u
ORDER BY NAME
