2013-07-18 92 views
0

我得到一個錯誤代碼1248,不知道爲什麼。提前致謝。mysql錯誤代碼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 

回答

2

錯誤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 
+0

謝謝@eggyal – dsaliba

+0

感謝的@eggyal,節省我的時間 – projo