我正在尝试创建一个临时表,然后插入一个查询来替换该虚拟表中的数据。
在插入新数据之前,我想要获得的最终虚拟表看起来像这样:
Year MonthNum Month Application ResourceClass UptimePercent
2013 1 Jan Service1 Enterprise Service 1
2013 2 Feb Service1 Enterprise Service 1
2013 3 Mar Service1 Enterprise Service 1
2013 4 Apr Service1 Enterprise Service 1
2013 5 May Service1 Enterprise Service 1
2013 6 Jun Service1 Enterprise Service 1
2013 7 Jul Service1 Enterprise Service 1
2013 8 Aug Service1 Enterprise Service 1
2013 9 Sep Service1 Enterprise Service 1
2013 10 Oct Service1 Enterprise Service 1
2013 11 Nov Service1 Enterprise Service 1
2013 12 Dec Service1 Enterprise Service 1
2013 1 Jan Service2 Enterprise Service 1
2013 2 Feb Service2 Enterprise Service 1
2013 3 Mar Service2 Enterprise Service 1
2013 4 Apr Service2 Enterprise Service 1
2013 5 May Service2 Enterprise Service 1
2013 6 Jun Service2 Enterprise Service 1
2013 7 Jul Service2 Enterprise Service 1
2013 8 Aug Service2 Enterprise Service 1
2013 9 Sep Service2 Enterprise Service 1
2013 10 Oct Service2 Enterprise Service 1
2013 11 Nov Service2 Enterprise Service 1
2013 12 Dec Service2 Enterprise Service 1
2013 1 Jan Service3 Enterprise Service 1
2013 2 Feb Service3 Enterprise Service 1
2013 3 Mar Service3 Enterprise Service 1
2013 4 Apr Service3 Enterprise Service 1
2013 5 May Service3 Enterprise Service 1
2013 6 Jun Service3 Enterprise Service 1
2013 7 Jul Service3 Enterprise Service 1
2013 8 Aug Service3 Enterprise Service 1
2013 9 Sep Service3 Enterprise Service 1
2013 10 Oct Service3 Enterprise Service 1
2013 11 Nov Service3 Enterprise Service 1
2013 12 Dec Service3 Enterprise Service 1
是否有人有一个很好的方法来引入与应用程序分开的日期部分以及UptimePercent?我不能为我的生活找到决心。
答案 0 :(得分:0)
是否有人有一个很好的方法来提取与应用程序分开的日期部分, 以及UptimePercent?
是。你可以这样做:
create newtable like oldtable;
无论如何,create like将适用于MySQL。然后:
insert into newtable (Year, MonthNum, Month, UptimePercent) select
Year, MonthNum, Month, UptimePercent from oldtable;