简化我的查询。获取Teradata假脱机空间错误

时间:2018-07-05 18:14:13

标签: space spool

SELECT a.XA_CUST_ID AS XAID,
    cast ((cast(pwd_updt_dt as format 'mmm')) as char(3))||cast ((cast(pwd_updt_dt as format 'yy')) as char(3)) as mmm,
    PWD_UPDT_DT,
     cast(user_name_create_ts as date format 'YYYYMMDD') as username_dt,b.open_dt,
              c.*
       FROM  table1 a 
       left join table2 b on (a.xa_cust_id=b.xa_cust_id)
       left join (select distinct 
       ar.actvy_dt,
       al.cust_num,
       AL.XA_CUST_ID AS XAID,rule_1_id,rule_2_id,rule_3_id,rule_4_id,rule_5_id,
                rule_6_id
                            FROM  table3   AR 
             join   table4 AL ON (ar.ACTVY_ID = AL.ACTVY_ID AND ar.ACTVY_DT = AL.ACTVY_DT  )
              left join table5 id on (id.SESSN_INTNL_ID=al.K_CKIE_TXT )            

        WHERE ar.ACTVY_DT BETWEEN   '2017-04-01' and '2018-04-30' 
           and al.XA_CUST_ID is not null
           and ar.actvy_dt is not null
                  and ar.actvy_id is not null
                  and al.k_Ckie_txt is not null) c on (a.xa_cust_id=c.xaid and pwd_updt_dt=c.actvy_dt)
                WHERE PWD_UPDT_DT BETWEEN  '2017-04-01' and '2018-04-30' 
               and pwd_updt_dt = cast(user_name_create_ts as date format 'YYYYMMDD')
                and xa_cust_id_stat_cd='A'
                and a.xa_cust_id is not null

order by a.XA_CUST_ID

0 个答案:

没有答案