CREATE OR REPLACE VIEW vw_legislacion_file AS select `legislacion_file`.`id` AS `id`,`legislacion_file`.`id_media` AS `id_media`,`legislacion_file`.`id_legislacion` AS `id_legislacion`,`legislacion_file`.`leyenda` AS `leyenda`,`legislacion_file`.`orden` AS `orden`,`media_files`.`type` AS `type`,`media_files`.`name` AS `name`,`media_files`.`filename` AS `filename`,`media_files`.`extension` AS `extension`,`media_files`.`size` AS `size`,`media_files`.`mime` AS `mime`,`media_files`.`mime_download` AS `mime_download`,`media_files`.`download_code` AS `download_code`,`media_files`.`width` AS `width`,`media_files`.`height` AS `height`,replace(if((`media_files`.`size` > ((1024 * 1024) * 1024)),concat(round((`media_files`.`size` / ((1024 * 1024) * 1024)),2),'Gb'),if((`media_files`.`size` > (1024 * 1024)),concat(round((`media_files`.`size` / (1024 * 1024)),2),'Mb'),if((`media_files`.`size` > 1024),concat(round((`media_files`.`size` / 1024),2),'Kb'),concat(`media_files`.`size`,'b')))),'.',',') AS `size_formatted` from (`legislacion_file` join `media_files` on((`legislacion_file`.`id_media` = `media_files`.`id`)))