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. iOS - UITableViewController

    前言 NS_CLASS_AVAILABLE_IOS(2_0) @interface UITableView : UIScrollView <NSCoding> @available(iOS ...

  2. SpringAop学习

    Spring Aop (jdk动态代理和cglib代理) Aop 的概念 aop即面向切面编程,一般解决具有横切面性质的体统(事务,缓存,安全) JDK动态代理: 可以使用实现proxy 类,实现jd ...

  3. [转载] 一些非常好的 linux 基础工具

    http://linuxtools-rst.readthedocs.org/zh_CN/latest/index.html 作者整理的非常好, 需要的时候可以拿来参考

  4. nodejs学习笔记<二>简单的node服务器

    在环境搭建好后,就可以开始动手架设(node驱动)一个简单的web服务器. 首先,nodejs还是用js编写.先来看一段node官网上的实例代码. var http = require('http') ...

  5. Activity中与ListActivity中使用listview区别

    Activity中与ListActivity中使用listview区别 一.Activity中与ListActivity中使用listview区别(本身没多大区别,只是ListActivity在lis ...

  6. 20160805_CentOS6_控制台切换

    1. Ctrl + Alt + F1~F6 Ctrl + Alt + F1 是 图形界面(如果装了的话),后面的是 控制台界面 2. 3.

  7. C# Socket编程(4)初识Socket和数据流

    经过前面基础知识作为背景,现在对Socket编程进行进一步的学习.在System.Net.Socket命名空间提供了Socket类,利用该类我们可以直接编写Socket的客户端和服务的的程序.但是直接 ...

  8. Hbase之校验指定数据是否存在

    import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; impo ...

  9. mathematics

    二倍角公式 史济怀-数学分析1-2003-09-19_2.asx-在线播放-优酷网,视频高清在线观看http://v.youku.com/v_show/id_XMTMzMDU1MTgw.html 国立 ...

  10. robotframework笔记23

    远程库接口 远程库接口提供了对在测试库 比机器人框架本身是在不同的机器上运行, 同时实现图书馆使用其他语言比 本机支持Python和Java. 为一个测试库用户远程 library看起来几乎一样的其他 ...