打开APP
未登录
开通VIP,畅享免费电子书等14项超值服
开通VIP
首页
好书
留言交流
下载APP
联系客服
金蝶K3销售客户数量分析表
庋藏天下
>《kingdee》
2013.06.22
关注
按照销售订单统计出具体客户的年度各月份的下单情况
CREATE
proc
stkd_销售_重点客户数量分析表
--
stkd_销售_重点客户数量分析表 2006,''select * from t_item where fitemid=180
@year
int
,
@cust
varchar
(
80
)
as
set
nocount
on
create
table
#aa(
fnumber
varchar
(
80
),
fname
varchar
(
80
),
f1
decimal
default
(
0
),
f2
decimal
default
(
0
),
f3
decimal
default
(
0
),
f4
decimal
default
(
0
),
f5
decimal
default
(
0
),
f6
decimal
default
(
0
),
f7
decimal
default
(
0
),
f8
decimal
default
(
0
),
f9
decimal
default
(
0
),
f10
decimal
default
(
0
),
f11
decimal
default
(
0
),
f12
decimal
default
(
0
),
fall
decimal
default
(
0
)
)
insert
into
#aa
select
ti.fnumber,ti.fname,
sum
(
case
when
month
(po.fdate)
=
1
and
year
(po.fdate)
=
@year
then
poe.fqty
else
0
end
),
sum
(
case
when
month
(po.fdate)
=
2
and
year
(po.fdate)
=
@year
then
poe.fqty
else
0
end
),
sum
(
case
when
month
(po.fdate)
=
3
and
year
(po.fdate)
=
@year
then
poe.fqty
else
0
end
),
sum
(
case
when
month
(po.fdate)
=
4
and
year
(po.fdate)
=
@year
then
poe.fqty
else
0
end
),
sum
(
case
when
month
(po.fdate)
=
5
and
year
(po.fdate)
=
@year
then
poe.fqty
else
0
end
),
sum
(
case
when
month
(po.fdate)
=
6
and
year
(po.fdate)
=
@year
then
poe.fqty
else
0
end
),
sum
(
case
when
month
(po.fdate)
=
7
and
year
(po.fdate)
=
@year
then
poe.fqty
else
0
end
),
sum
(
case
when
month
(po.fdate)
=
8
and
year
(po.fdate)
=
@year
then
poe.fqty
else
0
end
),
sum
(
case
when
month
(po.fdate)
=
9
and
year
(po.fdate)
=
@year
then
poe.fqty
else
0
end
),
sum
(
case
when
month
(po.fdate)
=
10
and
year
(po.fdate)
=
@year
then
poe.fqty
else
0
end
),
sum
(
case
when
month
(po.fdate)
=
11
and
year
(po.fdate)
=
@year
then
poe.fqty
else
0
end
),
sum
(
case
when
month
(po.fdate)
=
12
and
year
(po.fdate)
=
@year
then
poe.fqty
else
0
end
),
0
from
seorder po,seorderentry poe,t_organization tog,t_icitem ti
where
po.finterid
=
poe.finterid
and
po.fcustid
=
tog.fitemid
and
tog.fname
=
@cust
and
poe.fitemid
=
ti.fitemid
group
by
ti.fnumber,ti.fname
update
#aa
set
fall
=
f1
+
f2
+
f3
+
f4
+
f5
+
f6
+
f7
+
f8
+
f9
+
f10
+
f11
+
f12
insert
into
#aa
select
'
合计
'
,
''
,
sum
(f1),
sum
(f2),
sum
(f3),
sum
(f4),
sum
(f5),
sum
(f6),
sum
(f7),
sum
(f8),
sum
(f9),
sum
(f10),
sum
(f11),
sum
(f12),
sum
(fall)
from
#aa
select
fnumber
as
物料编码,fname
as
物料名称,f1
as
一月,f2
as
二月,f3
as
三月,f4
as
四月,f5
as
五月,f6
as
六月,
f7
as
七月,f8
as
八月,f9
as
九月,f10
as
十月,f11
as
十一月,f12
as
十二月,fall
as
合计
from
#aa
order
by
fnumber
drop
table
#aa
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报
。
打开APP,阅读全文并永久保存
查看更多类似文章
猜你喜欢
类似文章
【热】
打开小程序,算一算2024你的财运
Excel+MSSQL开发金蝶K3欠料报表
删除冗余的SQL代码
从暂元里取出子元素 | Stata编程
PoE,PoE 和Hi
Sum up your 2010 in one word
SQL保留两位小数用法
更多类似文章 >>
生活服务
热点新闻
留言交流
回顶部
联系我们
分享
收藏
点击这里,查看已保存的文章
导长图
关注
一键复制
下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!
联系客服
微信登录中...
请勿关闭此页面
先别划走!
送你5元优惠券,购买VIP限时立减!
5
元
优惠券
优惠券还有
10:00
过期
马上使用
×