zoukankan      html  css  js  c++  java
  • SQL

    《按每天,某个时间段》

    select A,B,C,DATETIME,CAST(CONVERT(varchar(100), DATETIME, 112) AS INT ) AS daytime

    from  TABLE1

    WHERE 1=1

    AND CAST(DATETIME AS TIME) BETWEEN '21:00:00' AND '23:59:59'

    AND DATETIME>='2016-07-11' and DATETIME<'2016-07-15'

    group by A,B,C,DATETIME

    ---------------------------------------------

    《WITH AS 递归获取部门梯队》

    WITH dtTree

    AS (

    SELECT * FROM table1 ur

    WHERE DepartId = 0

    UNION ALL    --第二个查询作为递归成员, 下属成员的结果为空时,此递归结束。

    SELECT urTree.*    FROM dtTree

    INNER JOIN  table1  urTree

    ON dtTree.DepartId = urTree.DepartId  and urTree.NAME  =dtTree.NAME  

    )

    ---------------------------------------------

    《LINQ 合并集合后分组某一个字段》

    List<AppCallStatisticsModel> data3 = new List<AppCallStatisticsModel>();
    List<AppCallStatisticsModel> data2 = AppCallStatisticService.GetConnectRatePcInfo(searchModel);
    List<AppCallStatisticsModel> data1 = AppCallStatisticService.GetConnectRateAppInfo(searchModel);
    data3.AddRange(data2);
    data3.AddRange(data1);


    var query = from t in data3
    group t by t.SearchDate into g
    select new AppCallStatisticsModel()
    {
    SearchDate = g.Key,
    SeatCallPercent =g.Sum(c=>ConvertHelper.ToDecimal(c.SeatCallPercent)).ToString("0.00"),
    APPCallPercent = g.Sum(c=>ConvertHelper.ToDecimal(c.APPCallPercent)).ToString("0.00")
    };

  • 相关阅读:
    微信小程序 使用async await
    CSS currentColor 变量的使用
    wn.run万能命令
    (13)浮动布局(控制盒模型在页面的什么位置 什么是清浮动)
    (0)前端总结(HTML + CSS + JQ)
    (12)页面的布局(浮动布局)
    (11)盒模型
    (10)背景图片操作
    (9)字体操作
    (8)伪类选择器和鼠标悬停动画效果
  • 原文地址:https://www.cnblogs.com/chenhaibo/p/5673467.html
Copyright © 2011-2022 走看看