james-l
2/1/2017 - 1:54 AM

How to create a view in mysql

How to create a view in mysql

BEGIN;

CREATE  OR REPLACE VIEW `v_file_info_all` AS
SELECT file_info.*, 
	file_host.name AS host_name,
	file_type.name AS type_name
FROM file_info
LEFT JOIN file_host ON file_host.id = file_info.host_id
LEFT JOIN file_type ON file_type.id = file_info.type_id;

COMMIT;