tb1有字段aid,atitle,acontent,adate
tb2有字段bid,btitle,bcontent,bdate
现在新建一个表tb3,有字段id,title,content,date,tbname(用来区分是从那个表导入的).要把tb1和tb2的数据全部插入到tb3中.并在taname列中标明原表名.
tb2有字段bid,btitle,bcontent,bdate
现在新建一个表tb3,有字段id,title,content,date,tbname(用来区分是从那个表导入的).要把tb1和tb2的数据全部插入到tb3中.并在taname列中标明原表名.
select *,'表1' from tb1 union all
select *,'表2' from tb2
比如ta1的atitle和tb2的btitle对应tb3的title
select aid,atitle,acontent,adate,'表1' from tb1 union all
select bid,btitle,bcontent,bdate,'表2' from tb2