在两个具有相同列名的表上创建VIEW时,如何避免MySQL中的dup列名错误,如下所示
CREATE VIEW db.VI_RegionCity AS SELECT Region.Name, City.Name FROM db.Region Region, db.City City WHERE Region.RegionCode = City.RegionCode ERROR: Duplicate column name 'Name'
使用别名作为列名
CREATE VIEW db.VI_RegionCity AS SELECT Region.Name as Region_name, City.Name as City_name ...//rest of the query