标签:时空
长治购进数据
select e.rq,b.dwmch,c.spmch,c.shpgg,c.dw,c.jlgg,c.shengccj,c.shpchd,d.huowname,
a.pihao,a.baozhiqi,a.sxrq,a.shl,a.dj,a.hshj,
a.je,a.shlv,a.she,a.hsje,e.ywy
from jh_rkmx a(nolock)
join spkfk c(nolock) on a.spid=c.spid
left join huoweizl d(nolock) on a.hw=d.hw
join jh_rkhz e(nolock) on e.djbh=a.djbh
join mchk b(nolock) on e.dwbh=b.dwbh
where (a.djbh like ‘JH%‘)
and b.dwmch like ‘%振东%‘ and b.isjh=‘是‘ and b.beactive=‘是‘
and d.hw not in (‘HWI00000040‘,‘HWI00000041‘,‘HWI00000044‘,‘HWI00000045‘,‘HWI00000046‘)
and e.rq>=‘2015-01-01‘
order by b.danwbh,a.rq,a.djbh
select b.dwmch,left(a.rq,7) as yue,count(distinct a.spid) pzsh,sum(a.hsje) hsje
from jh_rkmx a(nolock)
join spkfk c(nolock) on a.spid=c.spid
left join huoweizl d(nolock) on a.hw=d.hw
join jh_rkhz e(nolock) on e.djbh=a.djbh
join mchk b(nolock) on e.dwbh=b.dwbh
where (a.djbh like ‘JH%‘)
and b.dwmch like ‘%振东%‘ and b.isjh=‘是‘ and b.beactive=‘是‘
and e.rq>=‘2015-01-01‘
and d.hw not in (‘HWI00000040‘,‘HWI00000041‘,‘HWI00000044‘,‘HWI00000045‘,‘HWI00000046‘)
group by b.dwmch,left(a.rq,7)
order by b.dwmch,yue
大同购进情况
select e.rq,b.dwmch,c.spmch,c.shpgg,c.dw,c.jlgg,c.shengccj,c.shpchd,d.huowname,
a.pihao,a.baozhiqi,a.sxrq,a.shl,a.dj,a.hshj,
a.je,a.shlv,a.she,a.hsje,e.ywy
from ywmxk a(nolock)
join spkfk c(nolock) on a.spid=c.spid
left join huoweizl d(nolock) on a.hw=d.hw
join cwk e(nolock) on e.djbh=a.djbh
join mchk b(nolock) on e.dwbh=b.dwbh
where (a.djbh like ‘JH%‘)
and b.dwmch like ‘%振东%‘ and b.isjh=‘是‘ and b.beactive=‘是‘
and e.rq>=‘2015-01-01‘
order by b.danwbh,a.rq,a.djbh
select b.dwmch,left(a.rq,7) as yue,count(distinct a.spid) pzsh,sum(a.hsje) hsje
from ywmxk a(nolock)
join spkfk c(nolock) on a.spid=c.spid
left join huoweizl d(nolock) on a.hw=d.hw
join cwk e(nolock) on e.djbh=a.djbh
join mchk b(nolock) on e.dwbh=b.dwbh
where (a.djbh like ‘JH%‘)
and b.dwmch like ‘%振东%‘ and b.isjh=‘是‘ and b.beactive=‘是‘
and e.rq>=‘2015-01-01‘
group by b.dwmch,left(a.rq,7)
order by b.dwmch,yue
标签:时空
原文地址:http://bks2015.blog.51cto.com/9847303/1655667