投资统计查询sql
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的更多相关文章
- 统计查询-sql
select --总注册人数(select COUNT(*) from [YYD_Users_RegInfo]) as TotalCount,--pc端注册人数(select COUNT(*) fro ...
- 电Call记录统计查询sql
DECLARE @startTime datetimeset @startTime='2016-07-12' SELECT * FROM (--坐席号/电话个数/通话总时长select zuoxi a ...
- Thinkphp查询 1.查询方式 2.表达式查询 3.快捷查询 4.区间查询 5.组合查询 6.统计查询 7.动态查询 8.SQL 查询
1.使用字符串作为条件查询 $user = M('User'); var_dump($user->where('id=1 AND user="蜡笔小新"')->sele ...
- [原创]java WEB学习笔记92:Hibernate学习之路-- -QBC 检索和本地 SQL 检索:基本的QBC 查询,带 AND 和 OR 的QBC,统计查询,排序,分页
本博客的目的:①总结自己的学习过程,相当于学习笔记 ②将自己的经验分享给大家,相互学习,互相交流,不可商用 内容难免出现问题,欢迎指正,交流,探讨,可以留言,也可以通过以下方式联系. 本人互联网技术爱 ...
- --投资情况统计详情sql
--投资情况统计详情sqlselect BidRecord.*, RegInfo.UserName,UserInfo.phone,BorrowInfo.Title,BorrowInfo.BorrowC ...
- mysql统计类似SQL语句查询次数
mysql统计类似SQL语句查询次数 vc-mysql-sniffer 工具抓取的sql分析. 1.先用shell脚本把所有enter符号替换为null,再根据语句前后的字符分隔语句 grep -Ev ...
- SQL Fundamentals: 分组统计查询(FROM-WHERE-GROUPBY-HAVING-SELECT-ORDER BY)
SQL Fundamentals || Oracle SQL语言 统计函数 单字段分组统计(GROUP BY) 多字段分组统计 HAVING子句 控制操作的显示列:基本的SELECT语句 控制行:限定 ...
- mysql按年度、季度、月度、周、日统计查询的sql语句
本文介绍一些mysql中用于查询的sql语句,包括按年度.季度.月度.周.日统计查询等,有需要的朋友,可以参考下. 一.年度查询 查询 本年度的数据 SELECT * FROM blog_arti ...
- thinkphp区间查询、统计查询、SQL直接查询
区间查询 $data['id']=array(array('gt',4),array('lt',10));//默认关系是(and)并且的关系 //SELECT * FROM `tp_user` WHE ...
随机推荐
- 教你如何拔取百度地图POI兴趣点
教你如何拔取百度地图POI兴趣点 通过聚合数据提供的接口,获取百度地图的POI兴趣点,并存储至数据库中. 实现: 1.聚合数据百度POI接口说明 调用聚合数据,首先得注册聚合.聚合数据提供的百度地 ...
- c trans
#define BUFSIZE 100 char buf[BUFSIZE]; ; int getch(void) { )? buf[--bufp] : getchar(); } void ungetc ...
- MySQL Server 5.7解压版缺少文件无法启动
如题: 一般认为5.7中mysql目录下 缺少data/mysql/目录,导致无法启动: 解决方案: 重新安装5.6即可: 1.删除5.7中安装的服务: 到mysql\bin目录下运行:mysqld ...
- JSON学习总结
最近几天使用json的需求比较急迫,所以学习了一下json.此文仅当笔记,以防忘却. 此文主要分为js和java总结: 先介绍json格式: JSON 数据的书写格式是:名称/值对. ***:可以更容 ...
- VB6.0
1. 安装包来自 http://msdn.itellyou.cn/ 下载的文件为: sc_vb6_ent_cd1.iso sc_vb6_ent_cd2.iso 2.安装时,"请输入产品的 I ...
- XMLHttpRequest对象进行Ajax操作
XMLHttpRequest 对象的三个常用的属性: 1. onreadystatechange 属性 onreadystatechange 属性存有处理服务器响应的函数. 请求状态改变的事件触发器 ...
- Oracle冷备份及其恢复
一. 冷备份的概念 冷备份是指在数据库关闭状态下所做的物理拷贝,也称脱机备份. 适合于非归档模式下的备份,而且也只能采用这种方式备份. 二. 需要备份的文件 必须备份的文件: 数据文件和控制文件 可以 ...
- pkg-config问题:
pkg-config是一个工具,可以用于检测相应的依赖环境. pkg-config用来检索系统中安装库文件的信息,典型的是用作库的编译和连接.一般来说,如果库的头文件不在/usr/include目录中 ...
- eclipse_中的注释_快捷键
eclipse 中的注释 快捷键 把要注释的代码选中,按Ctrl+Shift+/ /* */ 形式的 ctrl+/ //形式的 取消代码注释: 把要注释的代码选中,按Ctrl+Shift+\ /* ...
- JavaScript判断鼠标滑轮是向下还是向上滚动
我们常用的就是鼠标,鼠标中键一般都用于滑动网页,但是网页中很多很炫的效果,使用鼠标滑轮操作更好. 当然对于手机就没有这个设备了,所以就不用考虑手机端的实现方法,手机端有触摸滑动事件. 使用JavaSc ...