我收到错误代码1248,不知道为什么。提前致谢。
select substr(cbt,1,8) day,
max((delta_GTP_InDataPktGn+delta_GTP_OutDataPktGn))/900
from
(
select a.cbt, a.datetime,
a.GTP_InDataPktGn - b.GTP_InDataPktGn as delta_GTP_InDataPktGn,
a.GTP_OutDataPktGn - b.GTP_OutDataPktGn as delta_GTP_OutDataPktGn
from
( select cbt, STR_TO_DATE(substr(cbt,1,12),'%Y%m%d%H%i') as datetime,
GTP_InDataPktGn,
GTP_OutDataPktGn
from sgsn_GTP
) a
right join
(
select cbt, STR_TO_DATE(substr(cbt,1,12),'%Y%m%d%H%i') as datetime,
GTP_InDataPktGn,
GTP_OutDataPktGn
from sgsn_GTP
)
on a.datetime = addtime(b.datetime,"00:15:00")
) z
where z.cbt between 20130429000000 and 20130430980000
group by day
最佳答案
错误1248是ER_DERIVED_MUST_HAVE_ALIAS
,“每个派生表都必须具有自己的别名”。
连接右侧的派生表没有别名:
right join
(
select cbt, STR_TO_DATE(substr(cbt,1,12),'%Y%m%d%H%i') as datetime,
GTP_InDataPktGn,
GTP_OutDataPktGn
from sgsn_GTP
)
-- ^ missing b
关于mysql - mysql错误代码1248,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17718444/