MySQl 合并结构相同的多张表

CREATE TABLE goods_xinxi
        select * from goods_xinxi_0
        UNION ALL
        select * from goods_xinxi_1
        UNION ALL
        select * from goods_xinxi_2
        UNION ALL
        select * from goods_xinxi_3
        UNION ALL
        select * from goods_xinxi_4
        UNION ALL
        select * from goods_xinxi_5

  后续还可以加入多个表,示例只合并6张表

  合并需要用到的函数有 UNION ALL 和 UNION ,不同之处网上有很多介绍。

  

猜你喜欢

转载自www.cnblogs.com/Fantinai/p/10898092.html