DROP TABLE IF EXISTS `v_schedule`;
DROP VIEW IF EXISTS `v_schedule`;

CREATE OR REPLACE VIEW `_mydb_calendar`.`v_schedule` AS 
SELECT m_schedule.id_schedule, m_schedule.id_account, m_schedule.c_date, m_schedule.c_time1, m_schedule.c_time2, m_schedule.c_subject, m_schedule.c_memo, m_schedule.c_updatetime, m_schedule.c_delete, m_schedule.c_privacy, m_schedule.id_category, m_category.c_categoryName, m_category.c_categoryDisplayColor, m_category.c_iconImage, m_schedule.c_attachFile1, m_schedule.c_attachFile2, m_schedule.c_attachFile3, m_schedule.id_group, m_schedule.c_map, m_schedule.c_memo_strip_tags
FROM m_schedule
LEFT OUTER JOIN m_category ON m_schedule.id_category = m_category.id_category
WHERE m_schedule.c_delete = 0;

DROP TABLE IF EXISTS `v_weather`;
DROP VIEW IF EXISTS `v_weather`;

CREATE OR REPLACE VIEW `_mydb_calendar`.`v_weather` AS 
SELECT m_weather.*, r_kenmei.c_kenmei
FROM m_weather
LEFT OUTER JOIN r_kenmei ON m_weather.c_kenid = r_kenmei.c_kenid;
