select COUNT(*) from YYD_Users_RegInfo where regTime between '2016-07-11 00:00:00' and '2016-07-11 23:59:59'
union all select COUNT(*) from YYD_Users_RegInfo where regTime between '1980-01-01' and '2016-07-11 23:59:59'
union all select sum(amount) from YYD_Account_MoneyRecord
where (moneytype='充值' or moneytype='线下充值' ) and state=1 and paytime between '2016-07-11 00:00:00' and '2016-07-11 23:59:59'
union all select sum(amount) from [YYD_Account_MoneyRecord]
where (moneytype='充值' or moneytype='线下充值' ) and state=1 and paytime between '1980-01-01' and '2016-07-11 23:59:59'

--投资金额(当日)
--union all select sum(amount) from [YYD_Account_MoneyRecord]
--where moneytype in('参与投标','加入计划') and state=1 and createtime between '2016-07-11 00:00:00' and '2016-07-11 23:59:59'
union all select SUM(amount) from YYD_Borrow_BidRecord where status=1
and createtime between '2016-07-11 00:00:00' and '2016-07-11 23:59:59'
and borrow_id in(select borrow_id from YYD_Borrow_borrowinfo_ext as ext where ext.borrow_product<>50)

--投资金额(总累计)
--union all select sum(amount) from [YYD_Account_MoneyRecord]
--where moneytype in('参与投标','加入计划') and state=1 and createtime between '1980-01-01' and '2016-07-11 23:59:59'
union all select SUM(amount) from YYD_Borrow_BidRecord where status=1 and
createtime between '1980-01-01' and '2016-07-11 23:59:59'
and borrow_id in(select borrow_id from YYD_Borrow_borrowinfo_ext as ext where ext.borrow_product<>50)

union all select sum(amount) from [YYD_Account_MoneyRecord]
where (moneytype='提现' or moneytype='线下提现') and state=1 and paytime between '2016-07-11 00:00:00' and '2016-07-11 23:59:59'

union all select sum(amount) from [YYD_Account_MoneyRecord]
where (moneytype='提现' or moneytype='线下提现') and state=1 and paytime between '1980-01-01' and '2016-07-11 23:59:59'
union all select sum(USableAmount) from [YYD_Account_AccountInfo]

--首充数量(当天)
union all select COUNT(*) from YYD_Users_RegInfo
where ID in(select distinct user_id from YYD_Account_RechargeRecord where amount>0 and state=1)
and regTime between '2016-07-11 00:00:00' and '2016-07-11 23:59:59'
--累计充值人数
union all select COUNT(*) from YYD_Users_RegInfo
where regTime between '1980-01-01' and '2016-07-11 23:59:59' and
ID in(select distinct user_id from YYD_Account_RechargeRecord where amount>0 and state=1)
--充值人数(当天)
union all select COUNT(*) from YYD_Account_RechargeRecord where amount>0 and state=1
and createtime between '2016-07-11 00:00:00' and '2016-07-11 23:59:59'

投资统计查询sql的更多相关文章

  1. 统计查询-sql

    select --总注册人数(select COUNT(*) from [YYD_Users_RegInfo]) as TotalCount,--pc端注册人数(select COUNT(*) fro ...

  2. 电Call记录统计查询sql

    DECLARE @startTime datetimeset @startTime='2016-07-12' SELECT * FROM (--坐席号/电话个数/通话总时长select zuoxi a ...

  3. Thinkphp查询 1.查询方式 2.表达式查询 3.快捷查询 4.区间查询 5.组合查询 6.统计查询 7.动态查询 8.SQL 查询

    1.使用字符串作为条件查询 $user = M('User'); var_dump($user->where('id=1 AND user="蜡笔小新"')->sele ...

  4. [原创]java WEB学习笔记92:Hibernate学习之路-- -QBC 检索和本地 SQL 检索:基本的QBC 查询,带 AND 和 OR 的QBC,统计查询,排序,分页

    本博客的目的:①总结自己的学习过程,相当于学习笔记 ②将自己的经验分享给大家,相互学习,互相交流,不可商用 内容难免出现问题,欢迎指正,交流,探讨,可以留言,也可以通过以下方式联系. 本人互联网技术爱 ...

  5. --投资情况统计详情sql

    --投资情况统计详情sqlselect BidRecord.*, RegInfo.UserName,UserInfo.phone,BorrowInfo.Title,BorrowInfo.BorrowC ...

  6. mysql统计类似SQL语句查询次数

    mysql统计类似SQL语句查询次数 vc-mysql-sniffer 工具抓取的sql分析. 1.先用shell脚本把所有enter符号替换为null,再根据语句前后的字符分隔语句 grep -Ev ...

  7. SQL Fundamentals: 分组统计查询(FROM-WHERE-GROUPBY-HAVING-SELECT-ORDER BY)

    SQL Fundamentals || Oracle SQL语言 统计函数 单字段分组统计(GROUP BY) 多字段分组统计 HAVING子句 控制操作的显示列:基本的SELECT语句 控制行:限定 ...

  8. mysql按年度、季度、月度、周、日统计查询的sql语句

    本文介绍一些mysql中用于查询的sql语句,包括按年度.季度.月度.周.日统计查询等,有需要的朋友,可以参考下. 一.年度查询 查询 本年度的数据   SELECT * FROM blog_arti ...

  9. thinkphp区间查询、统计查询、SQL直接查询

    区间查询 $data['id']=array(array('gt',4),array('lt',10));//默认关系是(and)并且的关系 //SELECT * FROM `tp_user` WHE ...

随机推荐

  1. eclipse 技巧

    1. eclipse中xml中提示需有xsd文档 如在线eclipse将自动网络获取.xsd 否则 手动本地添加(在xml catalog参数设置选项) 2.当明确实现功能时,可将已有方法抽取成接口, ...

  2. [转载] 高效MacBook工作环境配置

    原文: http://www.xialeizhou.com/?p=71 高效MacBook工作环境配置 发表于 2015 年 8 月 1 日 由 xialeizhou 本文记录整个配置过程,供新入手M ...

  3. Android批量图片加载经典系列——采用二级缓存、异步加载网络图片

    一.问题描述 Android应用中经常涉及从网络中加载大量图片,为提升加载速度和效率,减少网络流量都会采用二级缓存和异步加载机制,所谓二级缓存就是通过先从内存中获取.再从文件中获取,最后才会访问网络. ...

  4. arr.sort()排序方法

    <!DOCTYPE html><html lang="zh-CN"><head> <meta charset="UTF-8&qu ...

  5. Spring Bean配置默认为单实例 pring Bean生命周期

    Bean默认的是单例的. 如果不想单例需要如下配置:<bean id="user" class="..." scope="singleton&q ...

  6. c++(vs上)与g++(linux下)对于++操作的汇编代码解读

    先来看一个代码,估计很多同学都碰到过其中的某一个. #include <stdio.h> #include <iostream> using namespace std; in ...

  7. Subversion中文手册(svnbook) TortoiseSVN中文帮助手册

    文档地址 http://svndoc.iusesvn.com/

  8. 转!!java反射机制

    Java 反射机制 基本概念 在Java运行时环境中,对于任意一个类,能否知道这个类有哪些属性和方法?对于任意一个对象,能否调用它的任意一个方法? 答案是肯定的. 这种动态获取类的信息以及动态调用对象 ...

  9. c++ string 与 char 互转 以及base64

    c++ string 与 char 互转 很简单如下 ] = {'A','B','C','D','E'}; printf("%s\n",bts); //char to string ...

  10. dom event无法获取问题

    下列几种情况下无法获取到event,ff浏览器没测试. 1.a标签href调用的js事件 2.调用parent中事件,即子窗口调用父窗口页面中js 3....