CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bs`.`VentasPorCliente` AS SELECT `v`.`Id_Cliente` AS `Id_Cliente`, round(sum(`v`.`importe`), 0) AS `VentaBasica`, `t`.`year` AS `year`, `t`.`month` AS `month` FROM ( `vn2008`.`time` `t` JOIN `bs`.`ventas` `v` ON(`v`.`fecha` = `t`.`date`) ) GROUP BY `v`.`Id_Cliente`, `t`.`year`, `t`.`month`