zoukankan      html  css  js  c++  java
  • 统计每日盈利最多的信息

    --用户投注表历史表
    create table t_Userinfo_his (
       rid            int              identity,
       userid               int                  not null, --用户ID
       nick                 varchar(50)          not null, --用户昵称
       termid               int                  not null, --比赛ID
       nums                 int                  not null, --投注数字
       instone              bigint               not null, --投入金额
       outstone             bigint               not null, --返还金额
       addtime              datetime             not null, --投注时间   
    )
    go



    --功能:统计每日盈利最多的用户
    --作者:测试人员
    --创建日期:2011-04-12
    create procedure p_daystar
    @date    datetime --从哪天开始统计
    as
    set nocount on
    set transaction isolation level read uncommitted
    set xact_abort on            
        --创建一个表变量,存储用户ID,用户当天总盈利,日期
        declare @tb table(userid int,outstone bigint,addtime char(10))
        insert @tb select userid,sum(outstone) as outstone,convert(char(10),addtime,20) as addtime from t_userinfo_his with(nolock)     
            where convert(char(10),addtime,20) >= @date
            group by userid ,convert(char(10),addtime,20)    
        --select * from @tb
        select addtime,max(outstone) as outstone ,userid=(select userid from @tb where addtime=a.addtime and outstone=max(a.outstone)) from @tb as a        
        group by addtime
    go
  • 相关阅读:
    PHP siege 压测 QPS大小
    macOs 使用Homebrew升级到MySQL 8系列之后,php无法连接解决方法
    Nginx无法加载.woff .eot .svg .ttf等解决办法
    layer 点击弹出图片
    glusterFS系统中文管理手册(转载)
    Linux 命令行总结
    linux /proc/meminfo 文件分析(转载)
    每秒执行一个shell脚本(转载)
    python SMTP邮件发送(转载)
    Python XML解析(转载)
  • 原文地址:https://www.cnblogs.com/mxw09/p/2014319.html
Copyright © 2011-2022 走看看