首页 > 数据库技术 > 详细

SQL Server2012关于表内事项出现次数降序排列(存储过程)

时间:2015-11-19 23:59:58      阅读:479      评论:0      收藏:0      [点我收藏+]
 1 USE [growup]
 2 GO
 3 SET ANSI_NULLS ON
 4 GO
 5 SET QUOTED_IDENTIFIER ON
 6 GO
 7 
 8 ALTER PROCEDURE  [dbo].[S_GetRankingList]
 9 @timestart datetime,
10 @timeend datetime
11 AS
12 BEGIN
13 
14     SET NOCOUNT ON;
15 
16     select *
17     from(
18     SELECT
19      count(1) as t,
20      S_BigClass as bc,
21      S_SmallClass as sc,
22      S_MatterName as mn from S_Matter
23      where 
24      @timestart<=S_PlanStart
25      and @timeend>=S_PlanStart
26      group by S_BigClass,S_SmallClass,S_MatterName
27      )as c
28      order by t desc
29 END

 

SQL Server2012关于表内事项出现次数降序排列(存储过程)

原文:http://www.cnblogs.com/laresh/p/4979426.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!