你是学数据挖掘的?那太好了,咱俩是同行。
没错,搞数据挖掘不用会编程,但是你一定得会写SQL语句,因为你肯定会跟数据库或数据仓库打交道,下面是我写的一个简单的SQL,你看看这是干什么的。
insert into stage.ods_pdcksj_tmp
select
'20041219' As SJRQ,
a2.ZHID as ZHID,
a1.AC_NO as ZH,
'-' as DZBH,
CASE WHEN a1.BAL<0 THEN a1.OVR_TT ELSE
a1.TT end As TT,
'0'||SUBSTR(a1.AC_NO,10,2) as JJ,
a2.kmdm as KMDM,
a1.ccy as BZ,
case when a3.PRODID is null then '99999999' else a3.PRODID end as CPDM,
'00000000' as DQR,
'00' AS DQQX,
a2.khwd as KHWD,
'CBANK' as XTLX,
CASE WHEN a1.BAL>0 THEN a1.BAL ELSE 0 END as YE,
a1.ADP_BAL as XDYE,
a1.int0 as YFLX,
a1.bud_int as YJTYFLX,
0 as YIFLX,
0 as LJYFLX,
case when a1.ccy='CNY' then 1 else cast(a6.FX_PRI/a6.FX_UT as DECIMAL(8,4) )*cast(a7.CNY_MID as DECIMAL(8,4)) /cast(a7.UNT as integer) end as ZRMBHL,
case when a1.ccy='USD' then 1 when a1.ccy <>'USD' then a6.FX_PRI/a6.FX_UT else 1 end as zmyhl,
a11.rate as lltemp,
CASE when a1.int_code = '-' then a1.int_rate else case when a5.rate is null then lltemp else a5.rate end end as LL,
case when a9.ftp is null then (2.9-LL)*YE/36000
else (a9.ftp-LL)*YE/36000 end as mll,
sum(case when a10.VCHF_VCH_SIGN='D' AND a10.VCHF_VCH_EC_IND='-' then a10.VCHF_VCH_AMT else 0 end) as JFFSE ,
sum(case when a10.VCHF_VCH_SIGN='C' AND a10.VCHF_VCH_EC_IND='-' then a10.VCHF_VCH_AMT else 0 end) as DFFSE,
sum(case when a10.VCHF_VCH_SIGN='D' AND a10.VCHF_VCH_EC_IND='-' then 1 else 0 end )as JFFSBS,
sum(case when a10.VCHF_VCH_SIGN='C' AND a10.VCHF_VCH_EC_IND='-' then 1 else 0 end )as DFFSBS,
sum(case when a10.VCHF_VCH_SIGN='D' AND a10.VCHF_VCH_EC_IND='-' then a10.VCHF_VCH_AMT else 0 end) as LJJFFSE,
sum(case when a10.VCHF_VCH_SIGN='C' AND a10.VCHF_VCH_EC_IND='-' then a10.VCHF_VCH_AMT else 0 end) as LJDFFSE,
sum(case when a10.VCHF_VCH_SIGN='D' AND a10.VCHF_VCH_EC_IND='-' then 1 else 0 end) as LJJFFSBS,
sum(case when a10.VCHF_VCH_SIGN='C' AND a10.VCHF_VCH_EC_IND='-' then 1 else 0 end) as LJDFFSBS
from
stage.cdtmst a1 left join stage.ods_pdckzhxx a2
on a1.ac_no = a2.zh
left join stage.ODS_PDFHZ a4
on a2.zh= a4.zh
left join stage.ODS_PRODTTJJCOMP a3
on a3.ttcode = a1.tt and a3.ACCOCHARACODE=a4.zhxz
left join stage.cmtfxr a6
on a1.ccy=a6.ccy and a6.typ='1' and a6.sdt<=20041219 and 20041219<a6.edt
left join stage.cmtcfxr a7
on a7.ccy='USD' and '999999'=a7.BK and a7.sdt<=20041219 and 20041219<a7.edt
left join stage.ODS_COD_PRODCOMP a8
on a3.PRODID=a8.PRODID and cast('2004-12-19' as date format 'YYYY-mm-dd')>=a8.INUREDATE
AND cast('2004-12-19' as date format 'YYYY-mm-dd')<a8.INVALDATE
left join stage.ODS_COD_PRODFTP a9
on a8.PRODCODE=a9.PRODCODE and a9.orgID='9999999' and a9.curr=a1.ccy
and cast('2004-12-19' as date format 'YYYY-mm-dd')>=a9.INUREDATE
AND cast('2004-12-19' as date format 'YYYY-mm-dd')<a9.INVALDATE
left join stage.CMTINT a5
on a1.ac_bk=a5.bk and a1.ccy=a5.ccy and a1.int_code=a5.cd0
and a1.int_code<>'-' and a5.sdt<=20041219 and 20041219<a5.edt
left join stage.CMTINT a11
on a11.bk='999999' and a11.sdt<=20041219 and 20041219<a11.edt and a1.ccy=a11.ccy and a1.int_code=a11.cd0
left join stage.AIQSCFVH a10 on a10.VCHF_VCH_AC=a1.AC_NO and a10.VCHF_TR_DATE='20041219'
group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24
;