201512004作業で使用されたクエリー文
5424 ワード
/* */
delete from GZ_RY_JBXX where rybm not in(
select distinct rybm from GZ_RY_GZJL)
delete from GZ_DW_DWXX where DWBM='1111111111'
/* 1111111111 */
select COUNT(0) from GZ_RY_JBXX where DWBM='1111111111'
/**/
select q.GZSFBM,q.DQZWBM,right(q.DQZWBM,2) HLW,q.GWDJ,q.XJ,q.RYBM,r.JSSJ
into #tempRY
from dbo.GZ_DW_DWXX AS d
INNER JOIN dbo.GZ_RY_JBXX AS r ON d.DWBM = r.DWBM
and d.SSQY='3601000000'
and d.DWZT='1'
and r.RYGLFS='2001'
inner join dbo.View_DQLSXX q on r.DWBM=q.DWBM and r.RYBM=q.RYBM
and q.TJYF='201412'
and q.GZSFBM in('22');
select * from #tempRY where GWDJ=13 and XJ=10 and DQZWBM!='220006'
//
select * from gz_sys_hylb
--where hy_mc=' '
select distinct unitno,hy_id
from v_danw_reny_xinx_gz06
where catano in ('21','22','23','24')
and ((state = '01' or state = '02') or (state > '02' and chgdate >= '201412'))
and niany='201412' and renyxz='2001' and (quhdm = '3601000000')
and unitno not in(
select distinct d.DWBM
from dsrsgz5_NB.dbo.GZ_DW_DWXX AS d
INNER JOIN dsrsgz5_NB.dbo.GZ_RY_JBXX AS r ON d.DWBM = r.DWBM
and d.SSQY='3601000000'
and d.DWZT='1'
and r.RYGLFS='2001'
inner join dsrsgz5_NB.dbo.View_DQLSXX q on r.DWBM=q.DWBM and r.RYBM=q.RYBM
and q.TJYF>='201401' and q.TJYF<='201412'
and q.DQZWBM like '2%'
where SSHY='015' and TJYF='201412'
)