CREATE VIEW rating_user_pm_view (
    pmTotalRate,
    pmTotalArticleScoring,
    user_id
) as
SELECT
    (
        COALESCE(pm_puntuality_rate.rate, 0) + COALESCE(pm_attitude_rate.rate, 0) + COALESCE(pm_quality_rate.rate, 0)
    ) as pmTotalRate,
    (
        select
            count(*)
        from
            scoring as sc
        where
            sc.user_id = user.id
            and sc.participant_type = 5
            and sc.scoring_type = 1
            and sc.scoring > 0
    ) AS `pmTotalArticleScoring`,
    `editors_view`.`user_id`
FROM
    `editors_view`
    LEFT JOIN `user` ON `editors_view`.`user_id` = `user`.`id`
    LEFT JOIN `scoring_puntuality_rate_view` `pm_puntuality_rate` ON (
        `editors_view`.`user_id` = `pm_puntuality_rate`.`user_id`
    )
    AND (`pm_puntuality_rate`.`participant_type` = 5)
    LEFT JOIN `scoring_attitude_rate_view` `pm_attitude_rate` ON (
        `editors_view`.`user_id` = `pm_attitude_rate`.`user_id`
    )
    AND (`pm_attitude_rate`.`participant_type` = 5)
    LEFT JOIN `scoring_quality_rate_view` `pm_quality_rate` ON (
        `editors_view`.`user_id` = `pm_quality_rate`.`user_id`
    )
    AND (`pm_quality_rate`.`participant_type` = 5)