CREATE VIEW `mod_bam_view_kpi` AS select `k`.`kpi_id` AS `kpi_id`,`b`.`ba_id` AS `ba_id`,`k`.`activate` AS `kpi_activate`,`b`.`activate` AS `ba_activate`,`b`.`name` AS `ba_name`,`k`.`host_id` AS `host_id`,`h`.`host_name` AS `kpi_host`,`k`.`service_id` AS `service_id`,`s`.`service_description` AS `kpi_service`,`k`.`id_indicator_ba` AS `id_indicator_ba`,`bk`.`name` AS `kpi_ba`,`k`.`meta_id` AS `meta_id`,`meta`.`meta_name` AS `kpi_meta`,`k`.`boolean_id` AS `boolean_id`,`boo`.`name` AS `kpi_boolean`,`b`.`icon_id` AS `icon_id`,`k`.`kpi_type` AS `kpi_type`,`k`.`config_type` AS `config_type`,`k`.`last_impact` AS `last_impact`,`k`.`last_level` AS `last_level`,`k`.`last_state_change` AS `last_state_change`,`k`.`current_status` AS `current_status`,`k`.`in_downtime` AS `in_downtime`,`k`.`acknowledged` AS `acknowledged`,`k`.`drop_warning` AS `drop_warning`,`k`.`drop_critical` AS `drop_critical`,`k`.`drop_unknown` AS `drop_unknown`,`k`.`drop_warning_impact_id` AS `drop_warning_impact_id`,`k`.`drop_critical_impact_id` AS `drop_critical_impact_id`,`k`.`drop_unknown_impact_id` AS `drop_unknown_impact_id`,`b`.`current_level` AS `ba_current_level`,`b`.`current_status` AS `ba_current_status`,`b`.`in_downtime` AS `ba_in_downtime`,`b`.`level_w` AS `level_w`,`b`.`level_c` AS `level_c` from ((((((`mod_bam_kpi` `k` join `mod_bam` `b` on((`b`.`ba_id` = `k`.`id_ba`))) left join `host` `h` on((`h`.`host_id` = `k`.`host_id`))) left join `service` `s` on((`s`.`service_id` = `k`.`service_id`))) left join `mod_bam` `bk` on((`bk`.`ba_id` = `k`.`id_indicator_ba`))) left join `meta_service` `meta` on((`meta`.`meta_id` = `k`.`meta_id`))) left join `mod_bam_boolean` `boo` on((`boo`.`boolean_id` = `k`.`boolean_id`))) order by `b`.`name`