mysql怎么把多张数据结构相同的表,合成一张视图表

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql怎么把多张数据结构相同的表,合成一张视图表相关的知识,希望对你有一定的参考价值。

mesh 表 结构为 id meshcg name price address brand datetime
tools 表 结构为 id toolscg name price address brand datetime
想合成的视图表为 iae 表结构为 cg name price address brand datetime
该怎么写

create view iae
as
select `meshcg` as `cg`,`name`,`price`,`address`,`brand`,`datetime` from `mesh`
union
select `toolscg` as `cg`,`name`,`price`,`address`,`brand`,`datetime` from `tools`
参考技术A create view iae
as
select `meshcg` as `cg`,`name`,`price`,`address`,`brand`,`datetime` from `mesh`
union
select `toolscg` as `cg`,`name`,`price`,`address`,`brand`,`datetime` from `tools`
参考技术B create view 视图名

as
select f1,f2,f3,f4 from table1
union
select f1,f2,f3,f4 from table2

以上是关于mysql怎么把多张数据结构相同的表,合成一张视图表的主要内容,如果未能解决你的问题,请参考以下文章

word怎么把几张图片合成一页打印出来?

abap 怎样使两张内表合成一个内表

怎么把几张图片合成为一张GIF格式的图片?

mysql 从相同类型的多张表中提取到一张表中

mysql有多张表如何快速复制表并把数据挪过去?

mysql里查询时怎么把一张表里的上级ID显示为上级名称?