要从这几个表中把字段名相同的数据放在一个视图中去,sql语句为:
DROP VIEW IF EXISTS `d5000`.`device_view`;
CREATE
VIEW `d5000`.`device_view`
AS
select ID,CODE,NAME,ST_ID,BV_ID,VL_ID from aclineend union all select ID,CODE,NAME,ST_ID,BV_ID,VL_ID from disconnector union all select ID,CODE,NAME,ST_ID,BV_ID,VL_ID from generatingunit union all select ID,CODE,NAME,ST_ID,BV_ID,VL_ID from compensator_p union all select ID,CODE,NAME,ST_ID,BV_ID,VL_ID from energyconsumer union all select ID,CODE,NAME,ST_ID,BV_ID,VL_ID from breaker
关键点:用union all 把这几个没有直接关联的表连接起来。