刘人维,洛克王国机械怪蛋,纳尼亚传奇3高清下载
先上一段代码,如下所示:
select distinct
b.orgid,b.companyid,b.areaid,b.custchannelid,b.custid,b.saletotalqty,
getdate() from kds400telsurveycustall_temp as tmp1 cross apply
(
select top 10 percent * from kds400telsurveycustall_temp tmp2
where tmp1.orgid=tmp2.orgid and tmp1.companyid=tmp2.companyid
and tmp1.areaid=tmp2.areaid and tmp1.custchannelid=tmp2.custchannelid
and tmp2.custchannelid in (1027,1028)
order by tmp2.orgid,tmp2.companyid,tmp2.areaid,tmp2.areatype,tmp2.custchannelid
) as b
这段代码的意思是获取取每个经销商在每个县级城市中两类客户
取各类客户的前3个月累计销量排名在前10%的客户进行调查。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
相关文章:
-
-
sql某个日期是当年的第几周
/* *周一作为一周的开始 *当年的1月1号所在的周算作第一周 */ CREATE function GetWeekIndexFirstDate ( @...
[阅读全文]
-
-
数据库SQL---范式
1、数据冗余导致的问题:冗余存储、更新异常、插入异常、删除异常。 2、函数依赖:一种完整性约束。 在关系模式r(R)中,α属于R,β属于R。 1)α函数...
[阅读全文]
-
-
数据库SQL---查询
1、查询所有列 select *from emp;--*表示所有的,from emp表示从emp表中查询。 2、查询指定列 select empno,e...
[阅读全文]
-
-
-
-
-
网友评论